Skip to content

Commit

Permalink
fix: testing harness
Browse files Browse the repository at this point in the history
track-changes is not signalled in the middle of our tests so we must
signal it ourselves
  • Loading branch information
justinbarclay committed May 2, 2024
1 parent a88eff7 commit ffb1bd5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ version:
download:
ifeq (,$(wildcard $(HOME)/.emacs.d/parinfer-rust/parinfer-rust-$(OS).so))
mkdir -p $(HOME)/.emacs.d/parinfer-rust
curl -L "https://github.com/justinbarclay/parinfer-rust/releases/download/v0.4.4/parinfer-rust-$(OS).so" -o "$(HOME)/.emacs.d/parinfer-rust/parinfer-rust-$(OS).so"
curl -L "https://github.com/justinbarclay/parinfer-rust/releases/download/v0.4.5/parinfer-rust-$(OS).so" -o "$(HOME)/.emacs.d/parinfer-rust/parinfer-rust-$(OS).so"
endif

test: clean elpa version download build
Expand Down
15 changes: 11 additions & 4 deletions test/test-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ extracted from the json-alist."
(setq parinfer-rust--previous-options (parinfer-rust--generate-options (parinfer-rust-make-option)
(parinfer-rust-make-changes))))
(move-cursor-to-current-position)
;; Parinfer's change tracking system is not triggered, signaled, so we need to
;; signal and call it ourselves
(parinfer-rust--execute)
(when remove-first-line ;; if we created a new line in move-cursor-current-position
(progn ;; remove it
Expand Down Expand Up @@ -199,11 +201,14 @@ extracted from the json-alist."
(parinfer-rust-mode)
(setq-local parinfer-rust--mode mode)
(when changes
(mapc
'apply-changes-in-buffer
changes))
(progn
(mapc
'apply-changes-in-buffer
changes)))
;; Parinfer's change tracking system is not triggered, signaled, so we need to signal and call it ourselves
(parinfer-rust--fetch-changes parinfer-rust--change-tracker)
(move-cursor-to-current-position)
(parinfer-rust--execute) ;; Parinfer execute doesn't run after apply-changes so we have to call in manually
(parinfer-rust--execute)
(parinfer-rust-mode)
(when remove-first-line
(progn
Expand Down Expand Up @@ -237,6 +242,8 @@ extracted from the json-alist."
(forward-line (1- lineNo))
(forward-char column)
(apply command nil)
;; Parinfer's change tracking system is not triggered, signaled, so we need to signal and call it ourselves
(parinfer-rust--fetch-changes parinfer-rust--change-tracker)
(parinfer-rust--execute)))
(setq parinfer-result-string (buffer-substring-no-properties (point-min) (point-max))) ;; Save the string before we kill our current buffer
(switch-to-buffer current)
Expand Down

0 comments on commit ffb1bd5

Please sign in to comment.