Browse Source

Rename `indium-breakpoint--breakpoints'

* indium-breakpoint.el (indium-breakpoint--breakpoints): rename to
  `indium-breakpoint--local-breakpoints'.
* test/unit/indium-breakpoint-test.el: Update tests.
workspaces
Nicolas Petton 3 years ago
parent
commit
9be497cec3
No known key found for this signature in database GPG Key ID: E8BCD7866AFCF978
2 changed files with 14 additions and 14 deletions
  1. +5
    -5
      indium-breakpoint.el
  2. +9
    -9
      test/unit/indium-breakpoint-test.el

+ 5
- 5
indium-breakpoint.el View File

@ -33,7 +33,7 @@
(eval-and-compile
(require 'indium-script))
(defvar indium-breakpoint--breakpoints (make-hash-table :weakness t)
(defvar indium-breakpoint--local-breakpoints (make-hash-table :weakness t)
"Table of all local breakpoints and their buffers.")
(defun indium-breakpoint-add (&optional condition)
@ -46,7 +46,7 @@ CONDITION is true."
:line (indium-location-line location)
:column (indium-location-column location)
:condition (or condition ""))))
(map-put indium-breakpoint--breakpoints brk (current-buffer))
(map-put indium-breakpoint--local-breakpoints brk (current-buffer))
(indium-breakpoint--add-overlay brk)
(when-indium-connected
(indium-backend-register-breakpoint (indium-current-connection-backend)
@ -68,7 +68,7 @@ CONDITION is true."
(when-indium-connected
(indium-backend-unregister-breakpoint (indium-current-connection-backend)
(indium-breakpoint-id brk)))
(map-delete indium-breakpoint--breakpoints brk)
(map-delete indium-breakpoint--local-breakpoints brk)
(indium-breakpoint--remove-overlay)))
(defun indium-breakpoint-remove-breakpoints-from-current-buffer ()
@ -171,7 +171,7 @@ An icon is added to the left fringe."
"Resolve breakpoints from all buffers.
When PRED is non-nil, only resolve breakpoints which satisfy (PRED brk)."
(let ((buffers (seq-uniq (map-values indium-breakpoint--breakpoints))))
(let ((buffers (seq-uniq (map-values indium-breakpoint--local-breakpoints))))
(seq-doseq (buf buffers)
(with-current-buffer buf
(indium-breakpoint--resolve-breakpoints-in-current-buffer pred)))))
@ -180,7 +180,7 @@ When PRED is non-nil, only resolve breakpoints which satisfy (PRED brk)."
"Remove the resolution information from all breakpoints."
(map-apply (lambda (brk _)
(indium-breakpoint-unresolve brk))
indium-breakpoint--breakpoints))
indium-breakpoint--local-breakpoints))
(defun indium-breakpoint--resolve-breakpoints-in-current-buffer (&optional pred)
"Resolve breakpoints from the current buffer.


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

@ -160,32 +160,32 @@
(indium-breakpoint--remove-overlay)
(expect (indium-breakpoint-buffer brk) :to-be nil)))))
(describe "Keeping track of breakpoints"
(describe "Keeping track of local breakpoints in buffers"
(it "should track breakpoints when added"
(with-js2-buffer "let a = 2;"
(let ((indium-breakpoint--breakpoints (make-hash-table :weakness t)))
(let ((indium-breakpoint--local-breakpoints (make-hash-table :weakness t)))
(indium-breakpoint-add)
(expect (seq-length (map-keys indium-breakpoint--breakpoints)) :to-be 1)
(expect (car (map-values indium-breakpoint--breakpoints)) :to-be (current-buffer)))))
(expect (seq-length (map-keys indium-breakpoint--local-breakpoints)) :to-be 1)
(expect (car (map-values indium-breakpoint--local-breakpoints)) :to-be (current-buffer)))))
(it "should untrack breakpoints when removed"
(with-js2-buffer "let a = 2;"
(let ((indium-breakpoint--breakpoints (make-hash-table :weakness t)))
(let ((indium-breakpoint--local-breakpoints (make-hash-table :weakness t)))
(indium-breakpoint-add)
(indium-breakpoint-remove)
(expect (seq-length (map-keys indium-breakpoint--breakpoints)) :to-be 0))))
(expect (seq-length (map-keys indium-breakpoint--local-breakpoints)) :to-be 0))))
(it "should untrack breakpoints when killing a buffer"
(with-js2-buffer "let a = 2;"
(let ((indium-breakpoint--breakpoints (make-hash-table :weakness t)))
(let ((indium-breakpoint--local-breakpoints (make-hash-table :weakness t)))
(indium-breakpoint-add)
(kill-buffer)
(expect (seq-length (map-keys indium-breakpoint--breakpoints)) :to-be 0)))))
(expect (seq-length (map-keys indium-breakpoint--local-breakpoints)) :to-be 0)))))
(describe "Breakpoint resolution"
(it "should be able to unresolve breakpoints"
(with-js2-buffer "let a = 2;"
(let ((indium-breakpoint--breakpoints (make-hash-table)))
(let ((indium-breakpoint--local-breakpoints (make-hash-table)))
(indium-breakpoint-add)
(let ((brk (indium-breakpoint-at-point)))
;; Fake the resolution of the breakpoint


Loading…
Cancel
Save