aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Belaïche2026-03-29 14:58:50 +0200
committerVincent Belaïche2026-03-29 14:58:50 +0200
commitde7032df11dff67378ab9bb33991f8fc9dfc375c (patch)
tree6a9978ba3d63e1706a6932958d3ee647078f9cf0
parenta01e67a563fa89a09aa8f5fc7eddd6747d477741 (diff)
downloademacs-scratch/ses-dynamic-coordinate-bindings.tar.gz
emacs-scratch/ses-dynamic-coordinate-bindings.zip
Inter-thread synchronize command-loop vs after entry hook.scratch/ses-dynamic-coordinate-bindings
* test/lisp/ses-tests.el (ses-tests--mutex) (ses-tests--condition, ses-tests--done): New object for inter-thread synchronisation. (ses-tests-snake-move): Add condition notification. (ses-tests-snake-move-after-entry): Add condition wait.
-rw-r--r--test/lisp/ses-tests.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el
index 270d576a15f..ab2bb5024f3 100644
--- a/test/lisp/ses-tests.el
+++ b/test/lisp/ses-tests.el
@@ -43,6 +43,14 @@
43 (defvar B2) 43 (defvar B2)
44 (defvar ses--toto)) 44 (defvar ses--toto))
45 45
46;; Inter-thread synchronisation to wait for after entry hook completion
47;; ----------------------------------------------------------------------
48(defvar ses-tests--mutex (make-mutex "ses-tests"))
49(defvar ses-tests--condition (make-condition-variable ses-tests--mutex
50 (mutex-name ses-tests--mutex)))
51(defvar ses-tests--done nil)
52
53
46;; Check no border effects 54;; Check no border effects
47;; ====================================================================== 55;; ======================================================================
48(defun ses-tests-check-no-border-effect () 56(defun ses-tests-check-no-border-effect ()
@@ -317,7 +325,10 @@ assuming a four columns sheet."
317 (forward-char count)) 325 (forward-char count))
318 (if (= ses-col 0) 326 (if (= ses-col 0)
319 (next-line count) 327 (next-line count)
320 (backward-char count)))) 328 (backward-char count)))
329 (with-mutex ses-tests--mutex
330 (setq ses-tests--done t)
331 (condition-notify ses-tests--condition)))
321 332
322(ert-deftest ses-tests-snake-move-after-entry () 333(ert-deftest ses-tests-snake-move-after-entry ()
323 "Test ses-after-entry-functions." 334 "Test ses-after-entry-functions."
@@ -333,7 +344,12 @@ assuming a four columns sheet."
333 (dotimes (i 16) 344 (dotimes (i 16)
334 ;; fill the SES sheet with snake move 345 ;; fill the SES sheet with snake move
335 (setq keys (concat (mapconcat #'string (number-to-string i) " ") " RET")) 346 (setq keys (concat (mapconcat #'string (number-to-string i) " ") " RET"))
336 (ert-play-keys keys) 347 (with-mutex ses-tests--mutex
348 (setq ses-tests--done nil)
349 (ert-play-keys keys)
350 (while (not ses-tests--done)
351 (condition-wait ses-tests--condition))
352 )
337 ;; build the snake move test vector 353 ;; build the snake move test vector
338 (push i cols) 354 (push i cols)
339 (when (= (logand i 3) 3); when row is complete 355 (when (= (logand i 3) 3); when row is complete