diff options
| author | Christian Ohler | 2011-03-03 02:01:51 -0700 |
|---|---|---|
| committer | Christian Ohler | 2011-03-03 02:01:51 -0700 |
| commit | de69c0a8d1ff21a0bd5663a555e47285aa1c70e1 (patch) | |
| tree | 657d4d8862a494ac6a2b13174943dad442d0735f /test | |
| parent | 7c0d14414fd20b67f52cec2df87ca0601acf2c90 (diff) | |
| download | emacs-de69c0a8d1ff21a0bd5663a555e47285aa1c70e1.tar.gz emacs-de69c0a8d1ff21a0bd5663a555e47285aa1c70e1.zip | |
Added fast path to ERT explanation of `equal'.
* emacs-lisp/ert.el (ert--explain-equal): New function.
(ert--explain-equal-rec): Renamed from `ert--explain-not-equal'.
All callers changed.
(ert--explain-equal-including-properties): Renamed from
`ert--explain-not-equal-including-properties'. All callers
changed.
* automated/ert-tests.el (ert-test-explain-not-equal-keymaps):
New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/automated/ert-tests.el | 33 |
2 files changed, 24 insertions, 14 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index dbfc6c6cefe..8b7feaddf62 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-03-03 Christian Ohler <ohler@gnu.org> | ||
| 2 | |||
| 3 | * automated/ert-tests.el (ert-test-explain-not-equal-keymaps): | ||
| 4 | New test. | ||
| 5 | |||
| 1 | 2011-02-20 Ulf Jasper <ulf.jasper@web.de> | 6 | 2011-02-20 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 7 | ||
| 3 | * automated/icalendar-tests.el: Move from icalendar-testsuite.el; | 8 | * automated/icalendar-tests.el: Move from icalendar-testsuite.el; |
diff --git a/test/automated/ert-tests.el b/test/automated/ert-tests.el index b6d70dee7e2..cea994f64b8 100644 --- a/test/automated/ert-tests.el +++ b/test/automated/ert-tests.el | |||
| @@ -796,27 +796,32 @@ This macro is used to test if macroexpansion in `should' works." | |||
| 796 | (should (equal (ert--string-first-line "foo\nbar") "foo")) | 796 | (should (equal (ert--string-first-line "foo\nbar") "foo")) |
| 797 | (should (equal (ert--string-first-line " foo\nbar\nbaz\n") " foo"))) | 797 | (should (equal (ert--string-first-line " foo\nbar\nbaz\n") " foo"))) |
| 798 | 798 | ||
| 799 | (ert-deftest ert-test-explain-not-equal () | 799 | (ert-deftest ert-test-explain-equal () |
| 800 | (should (equal (ert--explain-not-equal nil 'foo) | 800 | (should (equal (ert--explain-equal nil 'foo) |
| 801 | '(different-atoms nil foo))) | 801 | '(different-atoms nil foo))) |
| 802 | (should (equal (ert--explain-not-equal '(a a) '(a b)) | 802 | (should (equal (ert--explain-equal '(a a) '(a b)) |
| 803 | '(list-elt 1 (different-atoms a b)))) | 803 | '(list-elt 1 (different-atoms a b)))) |
| 804 | (should (equal (ert--explain-not-equal '(1 48) '(1 49)) | 804 | (should (equal (ert--explain-equal '(1 48) '(1 49)) |
| 805 | '(list-elt 1 (different-atoms (48 "#x30" "?0") | 805 | '(list-elt 1 (different-atoms (48 "#x30" "?0") |
| 806 | (49 "#x31" "?1"))))) | 806 | (49 "#x31" "?1"))))) |
| 807 | (should (equal (ert--explain-not-equal 'nil '(a)) | 807 | (should (equal (ert--explain-equal 'nil '(a)) |
| 808 | '(different-types nil (a)))) | 808 | '(different-types nil (a)))) |
| 809 | (should (equal (ert--explain-not-equal '(a b c) '(a b c d)) | 809 | (should (equal (ert--explain-equal '(a b c) '(a b c d)) |
| 810 | '(proper-lists-of-different-length 3 4 (a b c) (a b c d) | 810 | '(proper-lists-of-different-length 3 4 (a b c) (a b c d) |
| 811 | first-mismatch-at 3))) | 811 | first-mismatch-at 3))) |
| 812 | (let ((sym (make-symbol "a"))) | 812 | (let ((sym (make-symbol "a"))) |
| 813 | (should (equal (ert--explain-not-equal 'a sym) | 813 | (should (equal (ert--explain-equal 'a sym) |
| 814 | `(different-symbols-with-the-same-name a ,sym))))) | 814 | `(different-symbols-with-the-same-name a ,sym))))) |
| 815 | 815 | ||
| 816 | (ert-deftest ert-test-explain-not-equal-improper-list () | 816 | (ert-deftest ert-test-explain-equal-improper-list () |
| 817 | (should (equal (ert--explain-not-equal '(a . b) '(a . c)) | 817 | (should (equal (ert--explain-equal '(a . b) '(a . c)) |
| 818 | '(cdr (different-atoms b c))))) | 818 | '(cdr (different-atoms b c))))) |
| 819 | 819 | ||
| 820 | (ert-deftest ert-test-explain-equal-keymaps () | ||
| 821 | ;; This used to be very slow. | ||
| 822 | (should (equal (make-keymap) (make-keymap))) | ||
| 823 | (should (equal (make-sparse-keymap) (make-sparse-keymap)))) | ||
| 824 | |||
| 820 | (ert-deftest ert-test-significant-plist-keys () | 825 | (ert-deftest ert-test-significant-plist-keys () |
| 821 | (should (equal (ert--significant-plist-keys '()) '())) | 826 | (should (equal (ert--significant-plist-keys '()) '())) |
| 822 | (should (equal (ert--significant-plist-keys '(a b c d e f c g p q r nil s t)) | 827 | (should (equal (ert--significant-plist-keys '(a b c d e f c g p q r nil s t)) |
| @@ -852,21 +857,21 @@ This macro is used to test if macroexpansion in `should' works." | |||
| 852 | (should (equal (ert--abbreviate-string "bar" 1 t) "r")) | 857 | (should (equal (ert--abbreviate-string "bar" 1 t) "r")) |
| 853 | (should (equal (ert--abbreviate-string "bar" 0 t) ""))) | 858 | (should (equal (ert--abbreviate-string "bar" 0 t) ""))) |
| 854 | 859 | ||
| 855 | (ert-deftest ert-test-explain-not-equal-string-properties () | 860 | (ert-deftest ert-test-explain-equal-string-properties () |
| 856 | (should | 861 | (should |
| 857 | (equal (ert--explain-not-equal-including-properties #("foo" 0 1 (a b)) | 862 | (equal (ert--explain-equal-including-properties #("foo" 0 1 (a b)) |
| 858 | "foo") | 863 | "foo") |
| 859 | '(char 0 "f" | 864 | '(char 0 "f" |
| 860 | (different-properties-for-key a (different-atoms b nil)) | 865 | (different-properties-for-key a (different-atoms b nil)) |
| 861 | context-before "" | 866 | context-before "" |
| 862 | context-after "oo"))) | 867 | context-after "oo"))) |
| 863 | (should (equal (ert--explain-not-equal-including-properties | 868 | (should (equal (ert--explain-equal-including-properties |
| 864 | #("foo" 1 3 (a b)) | 869 | #("foo" 1 3 (a b)) |
| 865 | #("goo" 0 1 (c d))) | 870 | #("goo" 0 1 (c d))) |
| 866 | '(array-elt 0 (different-atoms (?f "#x66" "?f") | 871 | '(array-elt 0 (different-atoms (?f "#x66" "?f") |
| 867 | (?g "#x67" "?g"))))) | 872 | (?g "#x67" "?g"))))) |
| 868 | (should | 873 | (should |
| 869 | (equal (ert--explain-not-equal-including-properties | 874 | (equal (ert--explain-equal-including-properties |
| 870 | #("foo" 0 1 (a b c d) 1 3 (a b)) | 875 | #("foo" 0 1 (a b c d) 1 3 (a b)) |
| 871 | #("foo" 0 1 (c d a b) 1 2 (a foo))) | 876 | #("foo" 0 1 (c d a b) 1 2 (a foo))) |
| 872 | '(char 1 "o" (different-properties-for-key a (different-atoms b foo)) | 877 | '(char 1 "o" (different-properties-for-key a (different-atoms b foo)) |