diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/thread-tests.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index a00a9c84bd6..a447fb3914e 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el | |||
| @@ -34,10 +34,11 @@ | |||
| 34 | (declare-function thread--blocker "thread.c" (thread)) | 34 | (declare-function thread--blocker "thread.c" (thread)) |
| 35 | (declare-function thread-alive-p "thread.c" (thread)) | 35 | (declare-function thread-alive-p "thread.c" (thread)) |
| 36 | (declare-function thread-join "thread.c" (thread)) | 36 | (declare-function thread-join "thread.c" (thread)) |
| 37 | (declare-function thread-last-error "thread.c" ()) | 37 | (declare-function thread-last-error "thread.c" (&optional cleanup)) |
| 38 | (declare-function thread-name "thread.c" (thread)) | 38 | (declare-function thread-name "thread.c" (thread)) |
| 39 | (declare-function thread-signal "thread.c" (thread error-symbol data)) | 39 | (declare-function thread-signal "thread.c" (thread error-symbol data)) |
| 40 | (declare-function thread-yield "thread.c" ()) | 40 | (declare-function thread-yield "thread.c" ()) |
| 41 | (defvar main-thread) | ||
| 41 | 42 | ||
| 42 | (ert-deftest threads-is-one () | 43 | (ert-deftest threads-is-one () |
| 43 | "Test for existence of a thread." | 44 | "Test for existence of a thread." |
| @@ -71,6 +72,11 @@ | |||
| 71 | (skip-unless (featurep 'threads)) | 72 | (skip-unless (featurep 'threads)) |
| 72 | (should (listp (all-threads)))) | 73 | (should (listp (all-threads)))) |
| 73 | 74 | ||
| 75 | (ert-deftest threads-main-thread () | ||
| 76 | "Simple test for all-threads." | ||
| 77 | (skip-unless (featurep 'threads)) | ||
| 78 | (should (eq main-thread (car (all-threads))))) | ||
| 79 | |||
| 74 | (defvar threads-test-global nil) | 80 | (defvar threads-test-global nil) |
| 75 | 81 | ||
| 76 | (defun threads-test-thread1 () | 82 | (defun threads-test-thread1 () |
| @@ -275,6 +281,9 @@ | |||
| 275 | (thread-yield)) | 281 | (thread-yield)) |
| 276 | (should (equal (thread-last-error) | 282 | (should (equal (thread-last-error) |
| 277 | '(error "Error is called"))) | 283 | '(error "Error is called"))) |
| 284 | (should (equal (thread-last-error 'cleanup) | ||
| 285 | '(error "Error is called"))) | ||
| 286 | (should-not (thread-last-error)) | ||
| 278 | (setq th2 (make-thread #'threads-custom "threads-custom")) | 287 | (setq th2 (make-thread #'threads-custom "threads-custom")) |
| 279 | (should (threadp th2)))) | 288 | (should (threadp th2)))) |
| 280 | 289 | ||