aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorMichael Albinus2017-04-02 11:03:14 +0200
committerMichael Albinus2017-04-02 11:03:14 +0200
commit40a33a3cb711f894ac61691c03cc13e58bc38145 (patch)
tree27fcb032eb04a20bd57b412b2120d357f28ab7fa /test/lisp
parent59191cd0cbe8463f9095a71cb4048bb138d6e446 (diff)
parenta184a7edc58e1e053aa317a0f162df7e225597e1 (diff)
downloademacs-40a33a3cb711f894ac61691c03cc13e58bc38145.tar.gz
emacs-40a33a3cb711f894ac61691c03cc13e58bc38145.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/cl-lib-tests.el25
-rw-r--r--test/lisp/progmodes/js-tests.el37
-rw-r--r--test/lisp/url/url-auth-tests.el51
-rw-r--r--test/lisp/vc/ediff-ptch-tests.el78
4 files changed, 148 insertions, 43 deletions
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el
index b5946208f10..093cb3476c1 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -494,12 +494,29 @@
494 (should-not (cl-typep 1 'cl-lib-test-type))) 494 (should-not (cl-typep 1 'cl-lib-test-type)))
495 495
496(ert-deftest cl-lib-symbol-macrolet () 496(ert-deftest cl-lib-symbol-macrolet ()
497 ;; bug#26325
498 :expected-result :failed
497 (should (equal (cl-flet ((f (x) (+ x 5))) 499 (should (equal (cl-flet ((f (x) (+ x 5)))
498 (let ((x 5)) 500 (let ((x 5))
499 (f (+ x 6)))) 501 (f (+ x 6))))
500 (cl-symbol-macrolet ((f (+ x 6))) 502 ;; Go through `eval', otherwise the macro-expansion
501 (cl-flet ((f (x) (+ x 5))) 503 ;; error prevents running the whole test suite :-(
502 (let ((x 5)) 504 (eval '(cl-symbol-macrolet ((f (+ x 6)))
503 (f f))))))) 505 (cl-flet ((f (x) (+ x 5)))
506 (let ((x 5))
507 (f f))))
508 t))))
509
510(defmacro cl-lib-symbol-macrolet-4+5 ()
511 ;; bug#26068
512 (let* ((sname "x")
513 (s1 (make-symbol sname))
514 (s2 (make-symbol sname)))
515 `(cl-symbol-macrolet ((,s1 4)
516 (,s2 5))
517 (+ ,s1 ,s2))))
518
519(ert-deftest cl-lib-symbol-macrolet-2 ()
520 (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5))))
504 521
505;;; cl-lib.el ends here 522;;; cl-lib.el ends here
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index e030675e07c..8e1bac10cd1 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) {
140 (font-lock-ensure) 140 (font-lock-ensure)
141 (should (eq (get-text-property (point) 'face) (caddr test)))))) 141 (should (eq (get-text-property (point) 'face) (caddr test))))))
142 142
143(ert-deftest js-mode-propertize-bug-1 ()
144 (with-temp-buffer
145 (js-mode)
146 (save-excursion (insert "x"))
147 (insert "/")
148 ;; The bug was a hang.
149 (should t)))
150
151(ert-deftest js-mode-propertize-bug-2 ()
152 (with-temp-buffer
153 (js-mode)
154 (insert "function f() {
155 function g()
156 {
157 1 / 2;
158 }
159
160 function h() {
161")
162 (save-excursion
163 (insert "
164 00000000000000000000000000000000000000000000000000;
165 00000000000000000000000000000000000000000000000000;
166 00000000000000000000000000000000000000000000000000;
167 00000000000000000000000000000000000000000000000000;
168 00000000000000000000000000000000000000000000000000;
169 00000000000000000000000000000000000000000000000000;
170 00000000000000000000000000000000000000000000000000;
171 00000000000000000000000000000000000000000000000000;
172 00;
173 }
174}
175"))
176 (insert "/")
177 ;; The bug was a hang.
178 (should t)))
179
143(provide 'js-tests) 180(provide 'js-tests)
144 181
145;;; js-tests.el ends here 182;;; js-tests.el ends here
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
index 11e5a479720..30636db083c 100644
--- a/test/lisp/url/url-auth-tests.el
+++ b/test/lisp/url/url-auth-tests.el
@@ -77,6 +77,49 @@ server's WWW-Authenticate header field.")
77 :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" 77 :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863"
78 :expected-response "0d84884d967e04440efc77e9e2b5b561"))) 78 :expected-response "0d84884d967e04440efc77e9e2b5b561")))
79 79
80(ert-deftest url-auth-test-colonjoin ()
81 "Check joining strings with `:'."
82 (should (string= (url-digest-auth-colonjoin) ""))
83 (should (string= (url-digest-auth-colonjoin nil) ""))
84 (should (string= (url-digest-auth-colonjoin nil nil nil) "::"))
85 (should (string= (url-digest-auth-colonjoin "") ""))
86 (should (string= (url-digest-auth-colonjoin "" "") ":"))
87 (should (string= (url-digest-auth-colonjoin "one") "one"))
88 (should (string= (url-digest-auth-colonjoin "one" "two" "three") "one:two:three")))
89
90(ert-deftest url-auth-test-digest-ha1 ()
91 "Check HA1 computation."
92 (dolist (row url-auth-test-challenges)
93 (should (string= (url-digest-auth-make-ha1 (plist-get row :username)
94 (plist-get row :realm)
95 (plist-get row :password))
96 (plist-get row :expected-ha1)
97 ))))
98
99(ert-deftest url-auth-test-digest-ha2 ()
100 "Check HA2 computation."
101 (dolist (row url-auth-test-challenges)
102 (should (string= (url-digest-auth-make-ha2 (plist-get row :method)
103 (plist-get row :uri))
104 (plist-get row :expected-ha2)))))
105
106(ert-deftest url-auth-test-digest-request-digest ()
107 "Check digest response value."
108 (dolist (row url-auth-test-challenges)
109 (should (string= (plist-get row :expected-response)
110 (if (plist-member row :qop)
111 (url-digest-auth-make-request-digest-qop
112 (plist-get row :qop)
113 (plist-get row :expected-ha1)
114 (plist-get row :expected-ha2)
115 (plist-get row :nonce)
116 (plist-get row :nc)
117 (plist-get row :cnonce))
118 (url-digest-auth-make-request-digest
119 (plist-get row :expected-ha1)
120 (plist-get row :expected-ha2)
121 (plist-get row :nonce)))))))
122
80(ert-deftest url-auth-test-digest-create-key () 123(ert-deftest url-auth-test-digest-create-key ()
81 "Check user credentials in their hashed form." 124 "Check user credentials in their hashed form."
82 (dolist (challenge url-auth-test-challenges) 125 (dolist (challenge url-auth-test-challenges)
@@ -223,14 +266,12 @@ test and cannot be passed by arguments to `url-digest-auth'."
223 (progn 266 (progn
224 ;; We don't know these, just check that they exists. 267 ;; We don't know these, just check that they exists.
225 (should (string-match-p ".*response=\".*?\".*" auth)) 268 (should (string-match-p ".*response=\".*?\".*" auth))
226 ;; url-digest-auth doesn't return these AFAICS. 269 (should (string-match-p ".*nc=\".*?\".*" auth))
227;;; (should (string-match-p ".*nc=\".*?\".*" auth)) 270 (should (string-match-p ".*cnonce=\".*?\".*" auth)))
228;;; (should (string-match-p ".*cnonce=\".*?\".*" auth))
229 )
230 (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) 271 (should (string-match ".*response=\"\\(.*?\\)\".*" auth))
231 (should (string= (match-string 1 auth) 272 (should (string= (match-string 1 auth)
232 (plist-get challenge :expected-response)))) 273 (plist-get challenge :expected-response))))
233 ))) 274 )))
234 275
235(ert-deftest url-auth-test-digest-auth-opaque () 276(ert-deftest url-auth-test-digest-auth-opaque ()
236 "Check that `opaque' value is added to result when presented by 277 "Check that `opaque' value is added to result when presented by
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el
index 9aacb6bd20f..387786ced06 100644
--- a/test/lisp/vc/ediff-ptch-tests.el
+++ b/test/lisp/vc/ediff-ptch-tests.el
@@ -41,25 +41,31 @@ index 6a07f80..6e8e947 100644
41 41
42(ert-deftest ediff-ptch-test-bug26084 () 42(ert-deftest ediff-ptch-test-bug26084 ()
43 "Test for http://debbugs.gnu.org/26084 ." 43 "Test for http://debbugs.gnu.org/26084 ."
44 (let* ((tmpdir temporary-file-directory) 44 (skip-unless (executable-find "git"))
45 (foo (expand-file-name "foo" tmpdir)) 45 (skip-unless (executable-find ediff-patch-program))
46 (patch (expand-file-name "foo.diff" tmpdir)) 46 (let* ((tmpdir (make-temp-file "ediff-ptch-test" t))
47 (qux (expand-file-name "qux.txt" foo)) 47 (default-directory (file-name-as-directory tmpdir))
48 (bar (expand-file-name "bar.txt" foo)) 48 (patch (make-temp-file "ediff-ptch-test"))
49 (cmd " 49 (qux (expand-file-name "qux.txt" tmpdir))
50mkdir -p foo 50 (bar (expand-file-name "bar.txt" tmpdir))
51cd foo 51 (git-program (executable-find "git")))
52echo 'qux here' > qux.txt 52 ;; Create repository.
53echo 'bar here' > bar.txt 53 (with-temp-buffer
54git init 54 (insert "qux here\n")
55git add . && git commit -m 'Test repository.' 55 (write-region nil nil qux nil 'silent)
56echo 'foo here' > qux.txt 56 (erase-buffer)
57echo 'foo here' > bar.txt 57 (insert "bar here\n")
58git diff > ../foo.diff 58 (write-region nil nil bar nil 'silent))
59git reset --hard HEAD 59 (call-process git-program nil nil nil "init")
60")) 60 (call-process git-program nil nil nil "add" ".")
61 (setq default-directory tmpdir) 61 (call-process git-program nil nil nil "commit" "-m" "Test repository.")
62 (call-process-shell-command cmd) 62 ;; Update repo., save the diff and reset to initial state.
63 (with-temp-buffer
64 (insert "foo here\n")
65 (write-region nil nil qux nil 'silent)
66 (write-region nil nil bar nil 'silent))
67 (call-process git-program nil `(:file ,patch) nil "diff")
68 (call-process git-program nil nil nil "reset" "--hard" "HEAD")
63 (find-file patch) 69 (find-file patch)
64 (unwind-protect 70 (unwind-protect
65 (let* ((info 71 (let* ((info
@@ -76,23 +82,27 @@ git reset --hard HEAD
76 (dolist (x (list (cons patch1 bar) (cons patch2 qux))) 82 (dolist (x (list (cons patch1 bar) (cons patch2 qux)))
77 (with-temp-buffer 83 (with-temp-buffer
78 (insert (car x)) 84 (insert (car x))
79 (call-shell-region (point-min) 85 (call-process-region (point-min)
80 (point-max) 86 (point-max)
81 (format "%s %s %s %s" 87 ediff-patch-program
82 ediff-patch-program 88 nil nil nil
83 ediff-patch-options 89 "-b" (cdr x))))
84 ediff-backup-specs
85 (cdr x)))))
86 ;; Check backup files were saved correctly. 90 ;; Check backup files were saved correctly.
87 (dolist (x (list qux bar)) 91 (dolist (x (list qux bar))
88 (should-not (string= (with-temp-buffer 92 (let ((backup
89 (insert-file-contents x) 93 (car
90 (buffer-string)) 94 (directory-files
91 (with-temp-buffer 95 tmpdir 'full
92 (insert-file-contents (concat x ediff-backup-extension)) 96 (concat (file-name-nondirectory x) ".")))))
93 (buffer-string)))))) 97 (should-not
94 (delete-directory foo 'recursive) 98 (string= (with-temp-buffer
95 (delete-file patch)))) 99 (insert-file-contents x)
100 (buffer-string))
101 (with-temp-buffer
102 (insert-file-contents backup)
103 (buffer-string))))))
104 (delete-directory tmpdir 'recursive)
105 (delete-file patch)))))
96 106
97 107
98(provide 'ediff-ptch-tests) 108(provide 'ediff-ptch-tests)