Browse Source

Fix how a breakpoint location is computed

* indium-structs.el (indium-breakpoint-location): Fix movement to
  return the proper location. Rationale: given that (point-min) is 1,
  after (goto-char (point-min)), 0 must be passed to forward-char
  instead of 1. This is particularly important if the breakpoint is
  at (point-max) because forward-char would raise an error.
* test/unit/indium-breakpoint-test.el: Add test.
* test/unit/indium-structs-test.el ("Breakpoints"): Fix an incorrect
  test: the end of line 1 is still line 1.
drone
Damien Cassou 3 years ago
committed by Nicolas Petton
parent
commit
d2f5cf4d0d
3 changed files with 11 additions and 2 deletions
  1. +1
    -1
      indium-structs.el
  2. +9
    -0
      test/unit/indium-breakpoint-test.el
  3. +1
    -1
      test/unit/indium-structs-test.el

+ 1
- 1
indium-structs.el View File

@ -77,7 +77,7 @@
(with-current-buffer buf
(save-excursion
(goto-char (point-min))
(forward-char pos)
(forward-char (1- pos))
(back-to-indentation)
(indium-location-at-point)))))


+ 9
- 0
test/unit/indium-breakpoint-test.el View File

@ -210,5 +210,14 @@
(indium-breakpoint--unregister-all-breakpoints)
(expect (indium-breakpoint-resolved brk) :to-be nil))))))
(describe "Removing a breakpoint"
(it "should work when breakpoint is on point-max"
(with-js2-file
(goto-char (point-max))
(indium-breakpoint-add)
(expect (length (indium-breakpoint-breakpoints-at-point)) :to-be 1)
(indium-breakpoint-remove)
(expect (length (indium-breakpoint-breakpoints-at-point)) :to-be 0))))
(provide 'indium-breakpoint-test)
;;; indium-breakpoint-test.el ends here

+ 1
- 1
test/unit/indium-structs-test.el View File

@ -78,7 +78,7 @@
(save-excursion
(goto-char (point-max))
(expect (indium-location-line (indium-breakpoint-location brk))
:to-equal 2))))))
:to-equal 1))))))
(describe "Scopes"
(it "Should be able to make scopes from alists"


Loading…
Cancel
Save