aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2017-09-29 10:02:33 +0300
committerEli Zaretskii2017-09-29 10:02:33 +0300
commitc1ac8c170f17a98b7e5d6e098f707daeb71ea27d (patch)
treedffdc5f4a509ec200b69c09f52b979f42d31e10b /test
parent18073beb14f393b4bbcc92890a89dcfcb75fb7ac (diff)
parentaf130f900fc499f71ea22f10ba055a75ce35ed4e (diff)
downloademacs-c1ac8c170f17a98b7e5d6e098f707daeb71ea27d.tar.gz
emacs-c1ac8c170f17a98b7e5d6e098f707daeb71ea27d.zip
Merge branch 'emacs-26' of git.savannah.gnu.org:/srv/git/emacs into emacs-26
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/subr-x-tests.el9
-rw-r--r--test/lisp/net/tramp-tests.el15
-rw-r--r--test/lisp/textmodes/css-mode-tests.el21
-rw-r--r--test/lisp/xdg-tests.el3
4 files changed, 37 insertions, 11 deletions
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el
index 2c6740a96cf..0e8871d9a9c 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -397,9 +397,14 @@
397 (should (equal 1 (let ((x 1)) (and-let* (x))))) 397 (should (equal 1 (let ((x 1)) (and-let* (x)))))
398 (should (equal nil (and-let* ((x nil))))) 398 (should (equal nil (and-let* ((x nil)))))
399 (should (equal 1 (and-let* ((x 1))))) 399 (should (equal 1 (and-let* ((x 1)))))
400 (should-error (and-let* (nil (x 1))) :type 'setting-constant) 400 ;; The error doesn't trigger when compiled: the compiler will give
401 ;; a warning and then drop the erroneous code. Therefore, use
402 ;; `eval' to avoid compilation.
403 (should-error (eval '(and-let* (nil (x 1))) lexical-binding)
404 :type 'setting-constant)
401 (should (equal nil (and-let* ((nil) (x 1))))) 405 (should (equal nil (and-let* ((nil) (x 1)))))
402 (should-error (and-let* (2 (x 1))) :type 'wrong-type-argument) 406 (should-error (eval (and-let* (2 (x 1))) lexical-binding)
407 :type 'wrong-type-argument)
403 (should (equal 1 (and-let* ((2) (x 1))))) 408 (should (equal 1 (and-let* ((2) (x 1)))))
404 (should (equal 2 (and-let* ((x 1) (2))))) 409 (should (equal 2 (and-let* ((x 1) (2)))))
405 (should (equal nil (let ((x nil)) (and-let* (x) x)))) 410 (should (equal nil (let ((x nil)) (and-let* (x) x))))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 88e97092ed7..bfdc3017804 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2653,8 +2653,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2653 (tmp-name1 (tramp--test-make-temp-name nil quoted)) 2653 (tmp-name1 (tramp--test-make-temp-name nil quoted))
2654 (tmp-name2 (tramp--test-make-temp-name nil quoted)) 2654 (tmp-name2 (tramp--test-make-temp-name nil quoted))
2655 (tmp-name3 (tramp--test-make-temp-name 'local quoted)) 2655 (tmp-name3 (tramp--test-make-temp-name 'local quoted))
2656 (tmp-name4 (tramp--test-make-temp-name nil quoted))) 2656 (tmp-name4 (tramp--test-make-temp-name nil quoted))
2657 2657 (tmp-name5
2658 (expand-file-name (file-name-nondirectory tmp-name1) tmp-name4)))
2658 ;; Check `make-symbolic-link'. 2659 ;; Check `make-symbolic-link'.
2659 (unwind-protect 2660 (unwind-protect
2660 (tramp--test-ignore-make-symbolic-link-error 2661 (tramp--test-ignore-make-symbolic-link-error
@@ -2716,9 +2717,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2716 (funcall 2717 (funcall
2717 (if quoted 'tramp-compat-file-name-unquote 'identity) 2718 (if quoted 'tramp-compat-file-name-unquote 'identity)
2718 (file-remote-p tmp-name1 'localname)) 2719 (file-remote-p tmp-name1 'localname))
2719 (file-symlink-p 2720 (file-symlink-p tmp-name5)))
2720 (expand-file-name 2721 ;; `smbclient' does not show symlinks in directories, so
2721 (file-name-nondirectory tmp-name1) tmp-name4))))) 2722 ;; we cannot delete a non-empty directory. We delete the
2723 ;; file explicitely.
2724 (delete-file tmp-name5))
2722 2725
2723 ;; Cleanup. 2726 ;; Cleanup.
2724 (ignore-errors 2727 (ignore-errors
@@ -2737,7 +2740,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2737 (should-error 2740 (should-error
2738 (add-name-to-file tmp-name1 tmp-name2) 2741 (add-name-to-file tmp-name1 tmp-name2)
2739 :type 'file-already-exists) 2742 :type 'file-already-exists)
2740 ;; number means interactive case. 2743 ;; A number means interactive case.
2741 (cl-letf (((symbol-function 'yes-or-no-p) 'ignore)) 2744 (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
2742 (should-error 2745 (should-error
2743 (add-name-to-file tmp-name1 tmp-name2 0) 2746 (add-name-to-file tmp-name1 tmp-name2 0)
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
index f93fdbbc5af..47cf5f9244b 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -80,6 +80,27 @@
80 (equal (seq-sort #'string-lessp (css--value-class-lookup 'position)) 80 (equal (seq-sort #'string-lessp (css--value-class-lookup 'position))
81 '("bottom" "calc()" "center" "left" "right" "top")))) 81 '("bottom" "calc()" "center" "left" "right" "top"))))
82 82
83(ert-deftest css-test-current-defun-name ()
84 (with-temp-buffer
85 (insert "body { top: 0; }")
86 (goto-char 7)
87 (should (equal (css-current-defun-name) "body"))
88 (goto-char 18)
89 (should (equal (css-current-defun-name) "body"))))
90
91(ert-deftest css-test-current-defun-name-nested ()
92 (with-temp-buffer
93 (insert "body > .main a { top: 0; }")
94 (goto-char 20)
95 (should (equal (css-current-defun-name) "body > .main a"))))
96
97(ert-deftest css-test-current-defun-name-complex ()
98 (with-temp-buffer
99 (insert "input[type=submit]:hover { color: red; }")
100 (goto-char 30)
101 (should (equal (css-current-defun-name)
102 "input[type=submit]:hover"))))
103
83;;; Completion 104;;; Completion
84 105
85(defun css-mode-tests--completions () 106(defun css-mode-tests--completions ()
diff --git a/test/lisp/xdg-tests.el b/test/lisp/xdg-tests.el
index e3c9a743e44..b80f5e85524 100644
--- a/test/lisp/xdg-tests.el
+++ b/test/lisp/xdg-tests.el
@@ -42,9 +42,6 @@
42 (should (equal "frobnicate" (gethash "Exec" tab2)))) 42 (should (equal "frobnicate" (gethash "Exec" tab2))))
43 (should-error 43 (should-error
44 (xdg-desktop-read-file 44 (xdg-desktop-read-file
45 (expand-file-name "wrong.desktop" xdg-tests-data-dir)))
46 (should-error
47 (xdg-desktop-read-file
48 (expand-file-name "malformed.desktop" xdg-tests-data-dir))) 45 (expand-file-name "malformed.desktop" xdg-tests-data-dir)))
49 (let ((tab (xdg-desktop-read-file 46 (let ((tab (xdg-desktop-read-file
50 (expand-file-name "l10n.desktop" xdg-tests-data-dir))) 47 (expand-file-name "l10n.desktop" xdg-tests-data-dir)))