diff options
| author | Richard Stallman | 2020-02-06 18:30:47 -0500 |
|---|---|---|
| committer | Richard Stallman | 2020-02-06 18:30:47 -0500 |
| commit | c4be80112556e06bd7e92138e44051cc8c62e709 (patch) | |
| tree | 2392fb385569e10ad9d4d0ab2a48a1771131bf4e /test/src | |
| parent | 53f0de5d7719b43f184ce1a910f14882aedc50bc (diff) | |
| parent | 15814d0ccd95848a2a0513d93ab718a49b289598 (diff) | |
| download | emacs-c4be80112556e06bd7e92138e44051cc8c62e709.tar.gz emacs-c4be80112556e06bd7e92138e44051cc8c62e709.zip | |
Merge
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/alloc-tests.el | 7 | ||||
| -rw-r--r-- | test/src/emacs-module-tests.el | 26 | ||||
| -rw-r--r-- | test/src/fns-tests.el | 16 | ||||
| -rw-r--r-- | test/src/regex-emacs-tests.el | 4 |
4 files changed, 49 insertions, 4 deletions
diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el index 4eb776a0555..aa1ab1648f8 100644 --- a/test/src/alloc-tests.el +++ b/test/src/alloc-tests.el | |||
| @@ -51,3 +51,10 @@ | |||
| 51 | (should-not (eq x y)) | 51 | (should-not (eq x y)) |
| 52 | (dotimes (i 4) | 52 | (dotimes (i 4) |
| 53 | (should (eql (aref x i) (aref y i)))))) | 53 | (should (eql (aref x i) (aref y i)))))) |
| 54 | |||
| 55 | ;; Bug#39207 | ||
| 56 | (ert-deftest aset-nbytes-change () | ||
| 57 | (let ((s (make-string 1 ?a))) | ||
| 58 | (dolist (c (list 10003 ?b 128 ?c ?d (max-char) ?e)) | ||
| 59 | (aset s 0 c) | ||
| 60 | (should (equal s (make-string 1 c)))))) | ||
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index a2cb3e9b498..48d2e86a605 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -60,8 +60,9 @@ | |||
| 60 | (should (eq 0 | 60 | (should (eq 0 |
| 61 | (string-match | 61 | (string-match |
| 62 | (concat "#<module function " | 62 | (concat "#<module function " |
| 63 | "\\(at \\(0x\\)?[[:xdigit:]]+\\( from .*\\)?" | 63 | "\\(at \\(0x\\)?[[:xdigit:]]+ " |
| 64 | "\\|Fmod_test_sum from .*\\)>") | 64 | "with data 0x1234\\( from .*\\)?" |
| 65 | "\\|Fmod_test_sum with data 0x1234 from .*\\)>") | ||
| 65 | (prin1-to-string (nth 1 descr))))) | 66 | (prin1-to-string (nth 1 descr))))) |
| 66 | (should (= (nth 2 descr) 3))) | 67 | (should (= (nth 2 descr) 3))) |
| 67 | (should-error (mod-test-sum "1" 2) :type 'wrong-type-argument) | 68 | (should-error (mod-test-sum "1" 2) :type 'wrong-type-argument) |
| @@ -97,6 +98,7 @@ changes." | |||
| 97 | (rx bos "#<module function " | 98 | (rx bos "#<module function " |
| 98 | (or "Fmod_test_sum" | 99 | (or "Fmod_test_sum" |
| 99 | (and "at 0x" (+ hex-digit))) | 100 | (and "at 0x" (+ hex-digit))) |
| 101 | " with data 0x1234" | ||
| 100 | (? " from " (* nonl) "mod-test" (* nonl) ) | 102 | (? " from " (* nonl) "mod-test" (* nonl) ) |
| 101 | ">" eos) | 103 | ">" eos) |
| 102 | (prin1-to-string func))))) | 104 | (prin1-to-string func))))) |
| @@ -402,4 +404,24 @@ See Bug#36226." | |||
| 402 | (load so nil nil :nosuffix :must-suffix) | 404 | (load so nil nil :nosuffix :must-suffix) |
| 403 | (delete-file so)))) | 405 | (delete-file so)))) |
| 404 | 406 | ||
| 407 | (ert-deftest module/function-finalizer () | ||
| 408 | "Test that module function finalizers are properly called." | ||
| 409 | ;; We create and leak a couple of module functions with attached | ||
| 410 | ;; finalizer. Creating only one function risks spilling it to the | ||
| 411 | ;; stack, where it wouldn't be garbage-collected. However, with one | ||
| 412 | ;; hundred functions, there should be at least one that's | ||
| 413 | ;; unreachable. | ||
| 414 | (dotimes (_ 100) | ||
| 415 | (mod-test-make-function-with-finalizer)) | ||
| 416 | (cl-destructuring-bind (valid-before invalid-before) | ||
| 417 | (mod-test-function-finalizer-calls) | ||
| 418 | (should (zerop invalid-before)) | ||
| 419 | (garbage-collect) | ||
| 420 | (cl-destructuring-bind (valid-after invalid-after) | ||
| 421 | (mod-test-function-finalizer-calls) | ||
| 422 | (should (zerop invalid-after)) | ||
| 423 | ;; We don't require exactly 100 invocations of the finalizer, | ||
| 424 | ;; but at least one. | ||
| 425 | (should (> valid-after valid-before))))) | ||
| 426 | |||
| 405 | ;;; emacs-module-tests.el ends here | 427 | ;;; emacs-module-tests.el ends here |
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 60be2c6c2d7..c6ceae4a00e 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -858,6 +858,22 @@ | |||
| 858 | (puthash k k h))) | 858 | (puthash k k h))) |
| 859 | (should (= 100 (hash-table-count h))))) | 859 | (should (= 100 (hash-table-count h))))) |
| 860 | 860 | ||
| 861 | (ert-deftest test-sxhash-equal () | ||
| 862 | (should (= (sxhash-equal (* most-positive-fixnum most-negative-fixnum)) | ||
| 863 | (sxhash-equal (* most-positive-fixnum most-negative-fixnum)))) | ||
| 864 | (should (= (sxhash-equal (make-string 1000 ?a)) | ||
| 865 | (sxhash-equal (make-string 1000 ?a)))) | ||
| 866 | (should (= (sxhash-equal (point-marker)) | ||
| 867 | (sxhash-equal (point-marker)))) | ||
| 868 | (should (= (sxhash-equal (make-vector 1000 (make-string 10 ?a))) | ||
| 869 | (sxhash-equal (make-vector 1000 (make-string 10 ?a))))) | ||
| 870 | (should (= (sxhash-equal (make-bool-vector 1000 t)) | ||
| 871 | (sxhash-equal (make-bool-vector 1000 t)))) | ||
| 872 | (should (= (sxhash-equal (make-char-table nil (make-string 10 ?a))) | ||
| 873 | (sxhash-equal (make-char-table nil (make-string 10 ?a))))) | ||
| 874 | (should (= (sxhash-equal (record 'a (make-string 10 ?a))) | ||
| 875 | (sxhash-equal (record 'a (make-string 10 ?a)))))) | ||
| 876 | |||
| 861 | (ert-deftest test-secure-hash () | 877 | (ert-deftest test-secure-hash () |
| 862 | (should (equal (secure-hash 'md5 "foobar") | 878 | (should (equal (secure-hash 'md5 "foobar") |
| 863 | "3858f62230ac3c915f300c664312c63f")) | 879 | "3858f62230ac3c915f300c664312c63f")) |
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index 6a661afeff9..ad0271049c3 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el | |||
| @@ -161,7 +161,7 @@ what failed, if anything; valid values are 'search-failed, | |||
| 161 | 'compilation-failed and nil. I compare the beginning/end of each | 161 | 'compilation-failed and nil. I compare the beginning/end of each |
| 162 | group with their expected values. This is done with either | 162 | group with their expected values. This is done with either |
| 163 | BOUNDS-REF or SUBSTRING-REF; one of those should be non-nil. | 163 | BOUNDS-REF or SUBSTRING-REF; one of those should be non-nil. |
| 164 | BOUNDS-REF is a sequence \[start-ref0 end-ref0 start-ref1 | 164 | BOUNDS-REF is a sequence [start-ref0 end-ref0 start-ref1 |
| 165 | end-ref1 ....] while SUBSTRING-REF is the expected substring | 165 | end-ref1 ....] while SUBSTRING-REF is the expected substring |
| 166 | obtained by indexing the input string by start/end-ref. | 166 | obtained by indexing the input string by start/end-ref. |
| 167 | 167 | ||
| @@ -327,7 +327,7 @@ emacs requires an extra symbol character" | |||
| 327 | (defun regex-tests-BOOST-frob-escapes (s ispattern) | 327 | (defun regex-tests-BOOST-frob-escapes (s ispattern) |
| 328 | "Mangle \\ the way it is done in frob_escapes() in | 328 | "Mangle \\ the way it is done in frob_escapes() in |
| 329 | regex-tests-BOOST.c in glibc: \\t, \\n, \\r are interpreted; | 329 | regex-tests-BOOST.c in glibc: \\t, \\n, \\r are interpreted; |
| 330 | \\\\, \\^, \{, \\|, \} are unescaped for the string (not | 330 | \\\\, \\^, \\{, \\|, \\} are unescaped for the string (not |
| 331 | pattern)" | 331 | pattern)" |
| 332 | 332 | ||
| 333 | ;; this is all similar to (regex-tests-unextend) | 333 | ;; this is all similar to (regex-tests-unextend) |