File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -218,4 +218,30 @@ removed."
218
218
" TestTest Test test"
219
219
(haskell-utils-reduce-string " Test\r\n Test\n Test test" ))))
220
220
221
+ (ert-deftest post-command-hooks ()
222
+ " Test commands related `haskell-utils-async-post-command-flag' .
223
+ Tests flag updates and `post-command-hook' cleanup."
224
+ (with-temp-switch-to-buffer
225
+ ; ; set some random value to flag to test that it will be reseted
226
+ (setq haskell-utils-async-post-command-flag " non nil" )
227
+ (haskell-utils-async-watch-changes)
228
+ ; ; now flag should be empty
229
+ (should (null haskell-utils-async-post-command-flag))
230
+ ; ; execute some commands
231
+ (save-excursion (insert " Hello World!" ))
232
+ (execute-kbd-macro (kbd " SPC" ))
233
+ ; ; now flag should not be empty
234
+ (should (not (null haskell-utils-async-post-command-flag)))
235
+ ; ; check that hook was installed
236
+ (should (cl-member #'haskell-utils-async-update-post-command-flag
237
+ post-command-hook
238
+ :test #'equal ))
239
+ ; ; check that flag was cleaned up
240
+ (haskell-utils-async-stop-watching-changes (current-buffer ))
241
+ (should (null haskell-utils-async-post-command-flag))
242
+ ; ; check that hook was removed
243
+ (should (not (cl-member #'haskell-utils-async-update-post-command-flag
244
+ post-command-hook
245
+ :test #'equal )))))
246
+
221
247
; ;; haskell-utils-tests.el ends here
You can’t perform that action at this time.
0 commit comments