diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2017-04-02 11:03:14 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2017-04-02 11:03:14 +0200 |
commit | 40a33a3cb711f894ac61691c03cc13e58bc38145 (patch) | |
tree | 27fcb032eb04a20bd57b412b2120d357f28ab7fa /test/lisp | |
parent | 59191cd0cbe8463f9095a71cb4048bb138d6e446 (diff) | |
parent | a184a7edc58e1e053aa317a0f162df7e225597e1 (diff) | |
download | emacs-40a33a3cb711f894ac61691c03cc13e58bc38145.tar.gz |
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.el | 25 | ||||
-rw-r--r-- | test/lisp/progmodes/js-tests.el | 37 | ||||
-rw-r--r-- | test/lisp/url/url-auth-tests.el | 51 | ||||
-rw-r--r-- | test/lisp/vc/ediff-ptch-tests.el | 78 |
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 @@ (should-not (cl-typep 1 'cl-lib-test-type))) (ert-deftest cl-lib-symbol-macrolet () + ;; bug#26325 + :expected-result :failed (should (equal (cl-flet ((f (x) (+ x 5))) (let ((x 5)) (f (+ x 6)))) - (cl-symbol-macrolet ((f (+ x 6))) - (cl-flet ((f (x) (+ x 5))) - (let ((x 5)) - (f f))))))) + ;; Go through `eval', otherwise the macro-expansion + ;; error prevents running the whole test suite :-( + (eval '(cl-symbol-macrolet ((f (+ x 6))) + (cl-flet ((f (x) (+ x 5))) + (let ((x 5)) + (f f)))) + t)))) + +(defmacro cl-lib-symbol-macrolet-4+5 () + ;; bug#26068 + (let* ((sname "x") + (s1 (make-symbol sname)) + (s2 (make-symbol sname))) + `(cl-symbol-macrolet ((,s1 4) + (,s2 5)) + (+ ,s1 ,s2)))) + +(ert-deftest cl-lib-symbol-macrolet-2 () + (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5)))) ;;; 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)) { (font-lock-ensure) (should (eq (get-text-property (point) 'face) (caddr test)))))) +(ert-deftest js-mode-propertize-bug-1 () + (with-temp-buffer + (js-mode) + (save-excursion (insert "x")) + (insert "/") + ;; The bug was a hang. + (should t))) + +(ert-deftest js-mode-propertize-bug-2 () + (with-temp-buffer + (js-mode) + (insert "function f() { + function g() + { + 1 / 2; + } + + function h() { +") + (save-excursion + (insert " + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00; + } +} +")) + (insert "/") + ;; The bug was a hang. + (should t))) + (provide 'js-tests) ;;; 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.") :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" :expected-response "0d84884d967e04440efc77e9e2b5b561"))) +(ert-deftest url-auth-test-colonjoin () + "Check joining strings with `:'." + (should (string= (url-digest-auth-colonjoin) "")) + (should (string= (url-digest-auth-colonjoin nil) "")) + (should (string= (url-digest-auth-colonjoin nil nil nil) "::")) + (should (string= (url-digest-auth-colonjoin "") "")) + (should (string= (url-digest-auth-colonjoin "" "") ":")) + (should (string= (url-digest-auth-colonjoin "one") "one")) + (should (string= (url-digest-auth-colonjoin "one" "two" "three") "one:two:three"))) + +(ert-deftest url-auth-test-digest-ha1 () + "Check HA1 computation." + (dolist (row url-auth-test-challenges) + (should (string= (url-digest-auth-make-ha1 (plist-get row :username) + (plist-get row :realm) + (plist-get row :password)) + (plist-get row :expected-ha1) + )))) + +(ert-deftest url-auth-test-digest-ha2 () + "Check HA2 computation." + (dolist (row url-auth-test-challenges) + (should (string= (url-digest-auth-make-ha2 (plist-get row :method) + (plist-get row :uri)) + (plist-get row :expected-ha2))))) + +(ert-deftest url-auth-test-digest-request-digest () + "Check digest response value." + (dolist (row url-auth-test-challenges) + (should (string= (plist-get row :expected-response) + (if (plist-member row :qop) + (url-digest-auth-make-request-digest-qop + (plist-get row :qop) + (plist-get row :expected-ha1) + (plist-get row :expected-ha2) + (plist-get row :nonce) + (plist-get row :nc) + (plist-get row :cnonce)) + (url-digest-auth-make-request-digest + (plist-get row :expected-ha1) + (plist-get row :expected-ha2) + (plist-get row :nonce))))))) + (ert-deftest url-auth-test-digest-create-key () "Check user credentials in their hashed form." (dolist (challenge url-auth-test-challenges) @@ -223,14 +266,12 @@ test and cannot be passed by arguments to `url-digest-auth'." (progn ;; We don't know these, just check that they exists. (should (string-match-p ".*response=\".*?\".*" auth)) - ;; url-digest-auth doesn't return these AFAICS. -;;; (should (string-match-p ".*nc=\".*?\".*" auth)) -;;; (should (string-match-p ".*cnonce=\".*?\".*" auth)) - ) + (should (string-match-p ".*nc=\".*?\".*" auth)) + (should (string-match-p ".*cnonce=\".*?\".*" auth))) (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) (should (string= (match-string 1 auth) (plist-get challenge :expected-response)))) - ))) + ))) (ert-deftest url-auth-test-digest-auth-opaque () "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 (ert-deftest ediff-ptch-test-bug26084 () "Test for http://debbugs.gnu.org/26084 ." - (let* ((tmpdir temporary-file-directory) - (foo (expand-file-name "foo" tmpdir)) - (patch (expand-file-name "foo.diff" tmpdir)) - (qux (expand-file-name "qux.txt" foo)) - (bar (expand-file-name "bar.txt" foo)) - (cmd " -mkdir -p foo -cd foo -echo 'qux here' > qux.txt -echo 'bar here' > bar.txt -git init -git add . && git commit -m 'Test repository.' -echo 'foo here' > qux.txt -echo 'foo here' > bar.txt -git diff > ../foo.diff -git reset --hard HEAD -")) - (setq default-directory tmpdir) - (call-process-shell-command cmd) + (skip-unless (executable-find "git")) + (skip-unless (executable-find ediff-patch-program)) + (let* ((tmpdir (make-temp-file "ediff-ptch-test" t)) + (default-directory (file-name-as-directory tmpdir)) + (patch (make-temp-file "ediff-ptch-test")) + (qux (expand-file-name "qux.txt" tmpdir)) + (bar (expand-file-name "bar.txt" tmpdir)) + (git-program (executable-find "git"))) + ;; Create repository. + (with-temp-buffer + (insert "qux here\n") + (write-region nil nil qux nil 'silent) + (erase-buffer) + (insert "bar here\n") + (write-region nil nil bar nil 'silent)) + (call-process git-program nil nil nil "init") + (call-process git-program nil nil nil "add" ".") + (call-process git-program nil nil nil "commit" "-m" "Test repository.") + ;; Update repo., save the diff and reset to initial state. + (with-temp-buffer + (insert "foo here\n") + (write-region nil nil qux nil 'silent) + (write-region nil nil bar nil 'silent)) + (call-process git-program nil `(:file ,patch) nil "diff") + (call-process git-program nil nil nil "reset" "--hard" "HEAD") (find-file patch) (unwind-protect (let* ((info @@ -76,23 +82,27 @@ git reset --hard HEAD (dolist (x (list (cons patch1 bar) (cons patch2 qux))) (with-temp-buffer (insert (car x)) - (call-shell-region (point-min) - (point-max) - (format "%s %s %s %s" - ediff-patch-program - ediff-patch-options - ediff-backup-specs - (cdr x))))) + (call-process-region (point-min) + (point-max) + ediff-patch-program + nil nil nil + "-b" (cdr x)))) ;; Check backup files were saved correctly. (dolist (x (list qux bar)) - (should-not (string= (with-temp-buffer - (insert-file-contents x) - (buffer-string)) - (with-temp-buffer - (insert-file-contents (concat x ediff-backup-extension)) - (buffer-string)))))) - (delete-directory foo 'recursive) - (delete-file patch)))) + (let ((backup + (car + (directory-files + tmpdir 'full + (concat (file-name-nondirectory x) "."))))) + (should-not + (string= (with-temp-buffer + (insert-file-contents x) + (buffer-string)) + (with-temp-buffer + (insert-file-contents backup) + (buffer-string)))))) + (delete-directory tmpdir 'recursive) + (delete-file patch))))) (provide 'ediff-ptch-tests) |