aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lisp/calc/calc-tests.el7
-rw-r--r--test/src/thread-tests.el16
2 files changed, 15 insertions, 8 deletions
diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el
index fbd5f0e3a1d..101786c30e3 100644
--- a/test/lisp/calc/calc-tests.el
+++ b/test/lisp/calc/calc-tests.el
@@ -86,6 +86,13 @@ An existing calc stack is reused, otherwise a new one is created."
86 (math-read-expr "1m") "cm") 86 (math-read-expr "1m") "cm")
87 '(* -100 (var cm var-cm))))) 87 '(* -100 (var cm var-cm)))))
88 88
89(ert-deftest calc-imaginary-i ()
90 "Test `math-imaginary-i' for non-special-const values."
91 (let ((var-i (calcFunc-polar (calcFunc-sqrt -1))))
92 (should (math-imaginary-i)))
93 (let ((var-i (calcFunc-sqrt -1)))
94 (should (math-imaginary-i))))
95
89(ert-deftest test-calc-23889 () 96(ert-deftest test-calc-23889 ()
90 "Test for https://debbugs.gnu.org/23889 and 25652." 97 "Test for https://debbugs.gnu.org/23889 and 25652."
91 (skip-unless (>= math-bignum-digit-length 9)) 98 (skip-unless (>= math-bignum-digit-length 9))
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index cc1dff8a281..a87eb3e1591 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -34,7 +34,7 @@
34(declare-function mutex-lock "thread.c" (mutex)) 34(declare-function mutex-lock "thread.c" (mutex))
35(declare-function mutex-unlock "thread.c" (mutex)) 35(declare-function mutex-unlock "thread.c" (mutex))
36(declare-function thread--blocker "thread.c" (thread)) 36(declare-function thread--blocker "thread.c" (thread))
37(declare-function thread-alive-p "thread.c" (thread)) 37(declare-function thread-live-p "thread.c" (thread))
38(declare-function thread-join "thread.c" (thread)) 38(declare-function thread-join "thread.c" (thread))
39(declare-function thread-last-error "thread.c" (&optional cleanup)) 39(declare-function thread-last-error "thread.c" (&optional cleanup))
40(declare-function thread-name "thread.c" (thread)) 40(declare-function thread-name "thread.c" (thread))
@@ -63,11 +63,11 @@
63 (should 63 (should
64 (string= "hi bob" (thread-name (make-thread #'ignore "hi bob"))))) 64 (string= "hi bob" (thread-name (make-thread #'ignore "hi bob")))))
65 65
66(ert-deftest threads-alive () 66(ert-deftest threads-live ()
67 "Test for thread liveness." 67 "Test for thread liveness."
68 (skip-unless (featurep 'threads)) 68 (skip-unless (featurep 'threads))
69 (should 69 (should
70 (thread-alive-p (make-thread #'ignore)))) 70 (thread-live-p (make-thread #'ignore))))
71 71
72(ert-deftest threads-all-threads () 72(ert-deftest threads-all-threads ()
73 "Simple test for all-threads." 73 "Simple test for all-threads."
@@ -104,7 +104,7 @@
104 (let ((thread (make-thread #'threads-test-thread1))) 104 (let ((thread (make-thread #'threads-test-thread1)))
105 (and (= (thread-join thread) 23) 105 (and (= (thread-join thread) 23)
106 (= threads-test-global 23) 106 (= threads-test-global 23)
107 (not (thread-alive-p thread))))))) 107 (not (thread-live-p thread)))))))
108 108
109(ert-deftest threads-join-self () 109(ert-deftest threads-join-self ()
110 "Cannot `thread-join' the current thread." 110 "Cannot `thread-join' the current thread."
@@ -290,7 +290,7 @@
290 (let (th1 th2) 290 (let (th1 th2)
291 (setq th1 (make-thread #'threads-call-error "call-error")) 291 (setq th1 (make-thread #'threads-call-error "call-error"))
292 (should (threadp th1)) 292 (should (threadp th1))
293 (while (thread-alive-p th1) 293 (while (thread-live-p th1)
294 (thread-yield)) 294 (thread-yield))
295 (should (equal (thread-last-error) 295 (should (equal (thread-last-error)
296 '(error "Error is called"))) 296 '(error "Error is called")))
@@ -319,7 +319,7 @@
319 (while t (thread-yield)))))) 319 (while t (thread-yield))))))
320 (thread-signal thread 'error nil) 320 (thread-signal thread 'error nil)
321 (sit-for 1) 321 (sit-for 1)
322 (should-not (thread-alive-p thread)) 322 (should-not (thread-live-p thread))
323 (should (equal (thread-last-error) '(error))))) 323 (should (equal (thread-last-error) '(error)))))
324 324
325(ert-deftest threads-signal-main-thread () 325(ert-deftest threads-signal-main-thread ()
@@ -364,7 +364,7 @@
364 (setq new-thread (make-thread #'threads-test-condvar-wait)) 364 (setq new-thread (make-thread #'threads-test-condvar-wait))
365 365
366 ;; Make sure new-thread is alive. 366 ;; Make sure new-thread is alive.
367 (should (thread-alive-p new-thread)) 367 (should (thread-live-p new-thread))
368 (should (= (length (all-threads)) 2)) 368 (should (= (length (all-threads)) 2))
369 ;; Wait for new-thread to become blocked on the condvar. 369 ;; Wait for new-thread to become blocked on the condvar.
370 (while (not (eq (thread--blocker new-thread) threads-condvar)) 370 (while (not (eq (thread--blocker new-thread) threads-condvar))
@@ -377,7 +377,7 @@
377 (sleep-for 0.1) 377 (sleep-for 0.1)
378 ;; Make sure the thread is still there. This used to fail due to 378 ;; Make sure the thread is still there. This used to fail due to
379 ;; a bug in thread.c:condition_wait_callback. 379 ;; a bug in thread.c:condition_wait_callback.
380 (should (thread-alive-p new-thread)) 380 (should (thread-live-p new-thread))
381 (should (= (length (all-threads)) 2)) 381 (should (= (length (all-threads)) 2))
382 (should (eq (thread--blocker new-thread) threads-condvar)) 382 (should (eq (thread--blocker new-thread) threads-condvar))
383 383