aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJan D2015-04-26 13:55:01 +0200
committerJan D2015-04-26 13:55:01 +0200
commitf92ac2e82ed199d6f25d2a59508e08addb1150ac (patch)
treed7d7756e3dbce10d8f73c27815d815499f78c2bd /test
parent5a094119ce79723108abd90a1fcc33721e964823 (diff)
parenta40869789fc5502e3d4e393b7c31d78cb7f29aa1 (diff)
downloademacs-f92ac2e82ed199d6f25d2a59508e08addb1150ac.tar.gz
emacs-f92ac2e82ed199d6f25d2a59508e08addb1150ac.zip
Merge branch 'master' into cairo
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog.1 (renamed from test/ChangeLog)11
-rw-r--r--test/automated/data/package/package-test-server.py21
-rw-r--r--test/automated/eieio-test-methodinvoke.el2
-rw-r--r--test/automated/eshell.el31
-rw-r--r--test/automated/message-mode-tests.el60
-rw-r--r--test/automated/package-test.el55
-rw-r--r--test/automated/print-tests.el6
-rw-r--r--test/automated/process-tests.el70
-rw-r--r--test/automated/python-tests.el233
-rw-r--r--test/automated/seq-tests.el26
-rw-r--r--test/automated/tramp-tests.el22
-rw-r--r--test/indent/css-mode.css15
-rwxr-xr-xtest/indent/perl.perl9
13 files changed, 525 insertions, 36 deletions
diff --git a/test/ChangeLog b/test/ChangeLog.1
index f7bec2ee119..7f8eecfe8a2 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog.1
@@ -1,3 +1,12 @@
12015-04-06 Fabián Ezequiel Gallina <fgallina@gnu.org>
2
3 * automated/python-tests.el (python-info-assignment-statement-p-1)
4 (python-info-assignment-statement-p-2)
5 (python-info-assignment-statement-p-3, python-info-docstring-p-1)
6 (python-info-docstring-p-2, python-info-docstring-p-3)
7 (python-info-docstring-p-4, python-info-docstring-p-5)
8 (python-info-docstring-p-6): New tests.
9
12015-04-01 Artur Malabarba <bruce.connor.am@gmail.com> 102015-04-01 Artur Malabarba <bruce.connor.am@gmail.com>
2 11
3 * automated/package-test.el: Avoid async while testing. 12 * automated/package-test.el: Avoid async while testing.
@@ -298,7 +307,7 @@
298 307
299 * indent/shell.sh (bar): Use '[ $# -eq 0 ]', not '[ $# == 0 ]'. 308 * indent/shell.sh (bar): Use '[ $# -eq 0 ]', not '[ $# == 0 ]'.
300 This is more portable in shell scripts. 309 This is more portable in shell scripts.
301 Fixes: bug#19658 310 (Bug#19658)
302 311
3032015-01-23 Dmitry Gutov <dgutov@yandex.ru> 3122015-01-23 Dmitry Gutov <dgutov@yandex.ru>
304 313
diff --git a/test/automated/data/package/package-test-server.py b/test/automated/data/package/package-test-server.py
new file mode 100644
index 00000000000..35ca820f31f
--- /dev/null
+++ b/test/automated/data/package/package-test-server.py
@@ -0,0 +1,21 @@
1import sys
2import BaseHTTPServer
3from SimpleHTTPServer import SimpleHTTPRequestHandler
4
5
6HandlerClass = SimpleHTTPRequestHandler
7ServerClass = BaseHTTPServer.HTTPServer
8Protocol = "HTTP/1.0"
9
10if sys.argv[1:]:
11 port = int(sys.argv[1])
12else:
13 port = 8000
14 server_address = ('127.0.0.1', port)
15
16HandlerClass.protocol_version = Protocol
17httpd = ServerClass(server_address, HandlerClass)
18
19sa = httpd.socket.getsockname()
20print "Serving HTTP on", sa[0], "port", sa[1], "..."
21httpd.serve_forever()
diff --git a/test/automated/eieio-test-methodinvoke.el b/test/automated/eieio-test-methodinvoke.el
index 5263013434e..557f031d181 100644
--- a/test/automated/eieio-test-methodinvoke.el
+++ b/test/automated/eieio-test-methodinvoke.el
@@ -186,7 +186,7 @@
186 186
187(cl-defmethod make-instance ((p (subclass C)) &rest args) 187(cl-defmethod make-instance ((p (subclass C)) &rest args)
188 (eieio-test-method-store :STATIC 'C) 188 (eieio-test-method-store :STATIC 'C)
189 (call-next-method) 189 (cl-call-next-method)
190 ) 190 )
191 191
192(ert-deftest eieio-test-method-order-list-6 () 192(ert-deftest eieio-test-method-order-list-6 ()
diff --git a/test/automated/eshell.el b/test/automated/eshell.el
index d51355fe5ca..81898db79a7 100644
--- a/test/automated/eshell.el
+++ b/test/automated/eshell.el
@@ -166,6 +166,37 @@ e.g. \"{(+ 1 2)} 3\" => 3"
166 (eshell-command-result-p "+ 1 2; + $_ 4" 166 (eshell-command-result-p "+ 1 2; + $_ 4"
167 "3\n6\n"))) 167 "3\n6\n")))
168 168
169(ert-deftest eshell-test/escape-nonspecial ()
170 "Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
171special character."
172 (with-temp-eshell
173 (eshell-command-result-p "echo he\\llo"
174 "hello\n")))
175
176(ert-deftest eshell-test/escape-nonspecial-unicode ()
177 "Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
178unicode character (unicode characters are nonspecial by
179definition)."
180 (with-temp-eshell
181 (eshell-command-result-p "echo Vid\\éos"
182 "Vidéos\n")))
183
184(ert-deftest eshell-test/escape-nonspecial-quoted ()
185 "Test that the backslash is preserved for escaped nonspecial
186chars"
187 (with-temp-eshell
188 (eshell-command-result-p "echo \"h\\i\""
189 ;; Backslashes are doubled for regexp.
190 "h\\\\i\n")))
191
192(ert-deftest eshell-test/escape-special-quoted ()
193 "Test that the backslash is not preserved for escaped special
194chars"
195 (with-temp-eshell
196 (eshell-command-result-p "echo \"h\\\\i\""
197 ;; Backslashes are doubled for regexp.
198 "h\\\\i\n")))
199
169(ert-deftest eshell-test/command-running-p () 200(ert-deftest eshell-test/command-running-p ()
170 "Modeline should show no command running" 201 "Modeline should show no command running"
171 (with-temp-eshell 202 (with-temp-eshell
diff --git a/test/automated/message-mode-tests.el b/test/automated/message-mode-tests.el
new file mode 100644
index 00000000000..49a72b0e67a
--- /dev/null
+++ b/test/automated/message-mode-tests.el
@@ -0,0 +1,60 @@
1;;; message-mode-tests.el --- Tests for message-mode -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2015 Free Software Foundation, Inc.
4
5;; Author: João Távora <joaotavora@gmail.com>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Commentary:
23
24;; This file contains tests for message-mode.
25
26;;; Code:
27
28(require 'message)
29(require 'ert)
30(require 'ert-x)
31
32(ert-deftest message-mode-propertize ()
33 (with-temp-buffer
34 (unwind-protect
35 (let (message-auto-save-directory)
36 (message-mode)
37 (insert "here's an opener (\n"
38 "here's a sad face :-(\n"
39 "> here's citing someone with an opener (\n"
40 "and here's a closer ")
41 (let ((last-command-event ?\)))
42 (ert-simulate-command '(self-insert-command 1)))
43 ;; Syntax propertization doesn't kick in batch mode
44 (when noninteractive
45 (syntax-propertize (point-max)))
46 (backward-sexp)
47 (should (string= "here's an opener "
48 (buffer-substring-no-properties
49 (line-beginning-position)
50 (point))))
51 (forward-sexp)
52 (should (string= "and here's a closer )"
53 (buffer-substring-no-properties
54 (line-beginning-position)
55 (point)))))
56 (set-buffer-modified-p nil))))
57
58(provide 'message-mode-tests)
59
60;;; message-mode-tests.el ends here
diff --git a/test/automated/package-test.el b/test/automated/package-test.el
index 359f3541b41..4385ee0bd48 100644
--- a/test/automated/package-test.el
+++ b/test/automated/package-test.el
@@ -103,6 +103,7 @@
103(cl-defmacro with-package-test ((&optional &key file 103(cl-defmacro with-package-test ((&optional &key file
104 basedir 104 basedir
105 install 105 install
106 location
106 update-news 107 update-news
107 upload-base) 108 upload-base)
108 &rest body) 109 &rest body)
@@ -112,8 +113,7 @@
112 (process-environment (cons (format "HOME=%s" package-test-user-dir) 113 (process-environment (cons (format "HOME=%s" package-test-user-dir)
113 process-environment)) 114 process-environment))
114 (package-user-dir package-test-user-dir) 115 (package-user-dir package-test-user-dir)
115 (package-archives `(("gnu" . ,package-test-data-dir))) 116 (package-archives `(("gnu" . ,(or ,location package-test-data-dir))))
116 (old-yes-no-defn (symbol-function 'yes-or-no-p))
117 (default-directory package-test-file-dir) 117 (default-directory package-test-file-dir)
118 abbreviated-home-dir 118 abbreviated-home-dir
119 package--initialized 119 package--initialized
@@ -125,28 +125,31 @@
125 '((package-test-archive-upload-base (make-temp-file "pkg-archive-base-" t)) 125 '((package-test-archive-upload-base (make-temp-file "pkg-archive-base-" t))
126 (package-archive-upload-base package-test-archive-upload-base)) 126 (package-archive-upload-base package-test-archive-upload-base))
127 (list (cl-gensym)))) ;; Dummy value so `let' doesn't try to bind `nil' 127 (list (cl-gensym)))) ;; Dummy value so `let' doesn't try to bind `nil'
128 (let ((buf (get-buffer "*Packages*")))
129 (when (buffer-live-p buf)
130 (kill-buffer buf)))
128 (unwind-protect 131 (unwind-protect
129 (progn 132 (progn
130 ,(if basedir `(cd ,basedir)) 133 ,(if basedir `(cd ,basedir))
131 (setf (symbol-function 'yes-or-no-p) #'(lambda (&rest r) t))
132 (unless (file-directory-p package-user-dir) 134 (unless (file-directory-p package-user-dir)
133 (mkdir package-user-dir)) 135 (mkdir package-user-dir))
134 ,@(when install 136 (cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest r) t))
135 `((package-initialize) 137 ((symbol-function 'y-or-n-p) (lambda (&rest r) t)))
136 (package-refresh-contents) 138 ,@(when install
137 (mapc 'package-install ,install))) 139 `((package-initialize)
138 (with-temp-buffer 140 (package-refresh-contents)
139 ,(if file 141 (mapc 'package-install ,install)))
140 `(insert-file-contents ,file)) 142 (with-temp-buffer
141 ,@body)) 143 ,(if file
144 `(insert-file-contents ,file))
145 ,@body)))
142 146
143 (when (file-directory-p package-test-user-dir) 147 (when (file-directory-p package-test-user-dir)
144 (delete-directory package-test-user-dir t)) 148 (delete-directory package-test-user-dir t))
145 149
146 (when (and (boundp 'package-test-archive-upload-base) 150 (when (and (boundp 'package-test-archive-upload-base)
147 (file-directory-p package-test-archive-upload-base)) 151 (file-directory-p package-test-archive-upload-base))
148 (delete-directory package-test-archive-upload-base t)) 152 (delete-directory package-test-archive-upload-base t)))))
149 (setf (symbol-function 'yes-or-no-p) old-yes-no-defn))))
150 153
151(defmacro with-fake-help-buffer (&rest body) 154(defmacro with-fake-help-buffer (&rest body)
152 "Execute BODY in a temp buffer which is treated as the \"*Help*\" buffer." 155 "Execute BODY in a temp buffer which is treated as the \"*Help*\" buffer."
@@ -337,6 +340,32 @@ Must called from within a `tar-mode' buffer."
337 (package-menu-refresh) 340 (package-menu-refresh)
338 (should (package-installed-p 'simple-single '(1 4))))))) 341 (should (package-installed-p 'simple-single '(1 4)))))))
339 342
343(ert-deftest package-test-update-archives-async ()
344 "Test updating package archives asynchronously."
345 (skip-unless (executable-find "python2"))
346 (with-package-test (:basedir
347 package-test-data-dir
348 :location "http://0.0.0.0:8000/")
349 (let* ((package-menu-async t)
350 (process (start-process
351 "package-server" "package-server-buffer"
352 (executable-find "python2")
353 (expand-file-name "package-test-server.py"))))
354 (unwind-protect
355 (progn
356 (list-packages)
357 (should package--downloads-in-progress)
358 (should mode-line-process)
359 (should-not
360 (with-timeout (10 'timeout)
361 (while package--downloads-in-progress
362 (accept-process-output nil 1))
363 nil))
364 (goto-char (point-min))
365 (should
366 (search-forward-regexp "^ +simple-single" nil t)))
367 (kill-process process)))))
368
340(ert-deftest package-test-describe-package () 369(ert-deftest package-test-describe-package ()
341 "Test displaying help for a package." 370 "Test displaying help for a package."
342 371
diff --git a/test/automated/print-tests.el b/test/automated/print-tests.el
index 2761109d2d5..fe8c56553a8 100644
--- a/test/automated/print-tests.el
+++ b/test/automated/print-tests.el
@@ -21,6 +21,12 @@
21 21
22(require 'ert) 22(require 'ert)
23 23
24(ert-deftest print-hex-backslash ()
25 (should (string= (let ((print-escape-multibyte t)
26 (print-escape-newlines t))
27 (prin1-to-string "\u00A2\ff"))
28 "\"\\x00a2\\ff\"")))
29
24(ert-deftest terpri () 30(ert-deftest terpri ()
25 (should (string= (with-output-to-string 31 (should (string= (with-output-to-string
26 (princ 'abc) 32 (princ 'abc)
diff --git a/test/automated/process-tests.el b/test/automated/process-tests.el
index dabfbc56b78..1dab615bed0 100644
--- a/test/automated/process-tests.el
+++ b/test/automated/process-tests.el
@@ -72,4 +72,74 @@
72 (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n")))) 72 (should (string= (buffer-string) "arg1 = \"x &y\", arg2 = \n"))))
73 (when batfile (delete-file batfile)))))) 73 (when batfile (delete-file batfile))))))
74 74
75(ert-deftest process-test-stderr-buffer ()
76 (skip-unless (executable-find "bash"))
77 (let* ((stdout-buffer (generate-new-buffer "*stdout*"))
78 (stderr-buffer (generate-new-buffer "*stderr*"))
79 (proc (make-process :name "test"
80 :command (list "bash" "-c"
81 (concat "echo hello stdout!; "
82 "echo hello stderr! >&2; "
83 "exit 20"))
84 :buffer stdout-buffer
85 :stderr stderr-buffer))
86 (sentinel-called nil)
87 (start-time (float-time)))
88 (set-process-sentinel proc (lambda (proc msg)
89 (setq sentinel-called t)))
90 (while (not (or sentinel-called
91 (> (- (float-time) start-time)
92 process-test-sentinel-wait-timeout)))
93 (accept-process-output))
94 (cl-assert (eq (process-status proc) 'exit))
95 (cl-assert (= (process-exit-status proc) 20))
96 (should (with-current-buffer stdout-buffer
97 (goto-char (point-min))
98 (looking-at "hello stdout!")))
99 (should (with-current-buffer stderr-buffer
100 (goto-char (point-min))
101 (looking-at "hello stderr!")))))
102
103(ert-deftest process-test-stderr-filter ()
104 (skip-unless (executable-find "bash"))
105 (let* ((sentinel-called nil)
106 (stderr-sentinel-called nil)
107 (stdout-output nil)
108 (stderr-output nil)
109 (stdout-buffer (generate-new-buffer "*stdout*"))
110 (stderr-buffer (generate-new-buffer "*stderr*"))
111 (stderr-proc (make-pipe-process :name "stderr"
112 :buffer stderr-buffer))
113 (proc (make-process :name "test" :buffer stdout-buffer
114 :command (list "bash" "-c"
115 (concat "echo hello stdout!; "
116 "echo hello stderr! >&2; "
117 "exit 20"))
118 :stderr stderr-proc))
119 (start-time (float-time)))
120 (set-process-filter proc (lambda (proc input)
121 (push input stdout-output)))
122 (set-process-sentinel proc (lambda (proc msg)
123 (setq sentinel-called t)))
124 (set-process-filter stderr-proc (lambda (proc input)
125 (push input stderr-output)))
126 (set-process-sentinel stderr-proc (lambda (proc input)
127 (setq stderr-sentinel-called t)))
128 (while (not (or sentinel-called
129 (> (- (float-time) start-time)
130 process-test-sentinel-wait-timeout)))
131 (accept-process-output))
132 (cl-assert (eq (process-status proc) 'exit))
133 (cl-assert (= (process-exit-status proc) 20))
134 (should sentinel-called)
135 (should (equal 1 (with-current-buffer stdout-buffer
136 (point-max))))
137 (should (equal "hello stdout!\n"
138 (mapconcat #'identity (nreverse stdout-output) "")))
139 (should stderr-sentinel-called)
140 (should (equal 1 (with-current-buffer stderr-buffer
141 (point-max))))
142 (should (equal "hello stderr!\n"
143 (mapconcat #'identity (nreverse stderr-output) "")))))
144
75(provide 'process-tests) 145(provide 'process-tests)
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index b377a26f77a..ae4323ba8af 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -1014,7 +1014,7 @@ lines
1014def fn(a, b, c=True): 1014def fn(a, b, c=True):
1015 '''docstring 1015 '''docstring
1016 bunch 1016 bunch
1017 of 1017 of
1018 lines 1018 lines
1019 ''' 1019 '''
1020" 1020"
@@ -1022,16 +1022,17 @@ def fn(a, b, c=True):
1022 (should (eq (car (python-indent-context)) :after-block-start)) 1022 (should (eq (car (python-indent-context)) :after-block-start))
1023 (should (= (python-indent-calculate-indentation) 4)) 1023 (should (= (python-indent-calculate-indentation) 4))
1024 (python-tests-look-at "bunch") 1024 (python-tests-look-at "bunch")
1025 (should (eq (car (python-indent-context)) :inside-string)) 1025 (should (eq (car (python-indent-context)) :inside-docstring))
1026 (should (= (python-indent-calculate-indentation) 4)) 1026 (should (= (python-indent-calculate-indentation) 4))
1027 (python-tests-look-at "of") 1027 (python-tests-look-at "of")
1028 (should (eq (car (python-indent-context)) :inside-string)) 1028 (should (eq (car (python-indent-context)) :inside-docstring))
1029 (should (= (python-indent-calculate-indentation) 4)) 1029 ;; Any indentation deeper than the base-indent must remain unmodified.
1030 (should (= (python-indent-calculate-indentation) 8))
1030 (python-tests-look-at "lines") 1031 (python-tests-look-at "lines")
1031 (should (eq (car (python-indent-context)) :inside-string)) 1032 (should (eq (car (python-indent-context)) :inside-docstring))
1032 (should (= (python-indent-calculate-indentation) 4)) 1033 (should (= (python-indent-calculate-indentation) 4))
1033 (python-tests-look-at "'''") 1034 (python-tests-look-at "'''")
1034 (should (eq (car (python-indent-context)) :inside-string)) 1035 (should (eq (car (python-indent-context)) :inside-docstring))
1035 (should (= (python-indent-calculate-indentation) 4)))) 1036 (should (= (python-indent-calculate-indentation) 4))))
1036 1037
1037(ert-deftest python-indent-inside-string-3 () 1038(ert-deftest python-indent-inside-string-3 ()
@@ -1189,21 +1190,33 @@ def f():
1189 expected))))) 1190 expected)))))
1190 1191
1191(ert-deftest python-indent-region-5 () 1192(ert-deftest python-indent-region-5 ()
1192 "Test region indentation leaves strings untouched (start delimiter)." 1193 "Test region indentation for docstrings."
1193 (let ((contents " 1194 (let ((contents "
1194def f(): 1195def f():
1195''' 1196'''
1196this is 1197this is
1197a multiline 1198 a multiline
1198string 1199string
1199''' 1200'''
1201 x = \\
1202 '''
1203this is an arbitrarily
1204 indented multiline
1205 string
1206'''
1200") 1207")
1201 (expected " 1208 (expected "
1202def f(): 1209def f():
1203 ''' 1210 '''
1204this is 1211 this is
1205a multiline 1212 a multiline
1206string 1213 string
1214 '''
1215 x = \\
1216 '''
1217this is an arbitrarily
1218 indented multiline
1219 string
1207''' 1220'''
1208")) 1221"))
1209 (python-tests-with-temp-buffer 1222 (python-tests-with-temp-buffer
@@ -1985,19 +1998,36 @@ c()
1985 (should (save-excursion 1998 (should (save-excursion
1986 (beginning-of-line) 1999 (beginning-of-line)
1987 (looking-at "c()"))) 2000 (looking-at "c()")))
1988 ;; Movement next to a paren should do what lisp does and 2001 ;; The default behavior when next to a paren should do what lisp
1989 ;; unfortunately It can't change, because otherwise 2002 ;; does and, otherwise `blink-matching-open' breaks.
1990 ;; `blink-matching-open' breaks.
1991 (python-nav-forward-sexp -1) 2003 (python-nav-forward-sexp -1)
1992 (should (looking-at "()")) 2004 (should (looking-at "()"))
1993 (should (save-excursion 2005 (should (save-excursion
1994 (beginning-of-line) 2006 (beginning-of-line)
1995 (looking-at "c()"))) 2007 (looking-at "c()")))
1996 (python-nav-forward-sexp -1) 2008 (end-of-line)
2009 ;; Skipping parens should jump to `bolp'
2010 (python-nav-forward-sexp -1 nil t)
1997 (should (looking-at "c()")) 2011 (should (looking-at "c()"))
2012 (forward-line -1)
2013 (end-of-line)
2014 ;; b()
2015 (python-nav-forward-sexp -1)
2016 (should (looking-at "()"))
1998 (python-nav-forward-sexp -1) 2017 (python-nav-forward-sexp -1)
1999 (should (looking-at "b()")) 2018 (should (looking-at "b()"))
2019 (end-of-line)
2020 (python-nav-forward-sexp -1 nil t)
2021 (should (looking-at "b()"))
2022 (forward-line -1)
2023 (end-of-line)
2024 ;; a()
2000 (python-nav-forward-sexp -1) 2025 (python-nav-forward-sexp -1)
2026 (should (looking-at "()"))
2027 (python-nav-forward-sexp -1)
2028 (should (looking-at "a()"))
2029 (end-of-line)
2030 (python-nav-forward-sexp -1 nil t)
2001 (should (looking-at "a()")))) 2031 (should (looking-at "a()"))))
2002 2032
2003(ert-deftest python-nav-forward-sexp-2 () 2033(ert-deftest python-nav-forward-sexp-2 ()
@@ -4273,6 +4303,49 @@ def foo(a,
4273 (python-tests-look-at "c):") 4303 (python-tests-look-at "c):")
4274 (should (not (python-info-block-continuation-line-p))))) 4304 (should (not (python-info-block-continuation-line-p)))))
4275 4305
4306(ert-deftest python-info-assignment-statement-p-1 ()
4307 (python-tests-with-temp-buffer
4308 "
4309data = foo(), bar() \\\\
4310 baz(), 4 \\\\
4311 5, 6
4312"
4313 (python-tests-look-at "data = foo(), bar()")
4314 (should (python-info-assignment-statement-p))
4315 (should (python-info-assignment-statement-p t))
4316 (python-tests-look-at "baz(), 4")
4317 (should (python-info-assignment-statement-p))
4318 (should (not (python-info-assignment-statement-p t)))
4319 (python-tests-look-at "5, 6")
4320 (should (python-info-assignment-statement-p))
4321 (should (not (python-info-assignment-statement-p t)))))
4322
4323(ert-deftest python-info-assignment-statement-p-2 ()
4324 (python-tests-with-temp-buffer
4325 "
4326data = (foo(), bar()
4327 baz(), 4
4328 5, 6)
4329"
4330 (python-tests-look-at "data = (foo(), bar()")
4331 (should (python-info-assignment-statement-p))
4332 (should (python-info-assignment-statement-p t))
4333 (python-tests-look-at "baz(), 4")
4334 (should (python-info-assignment-statement-p))
4335 (should (not (python-info-assignment-statement-p t)))
4336 (python-tests-look-at "5, 6)")
4337 (should (python-info-assignment-statement-p))
4338 (should (not (python-info-assignment-statement-p t)))))
4339
4340(ert-deftest python-info-assignment-statement-p-3 ()
4341 (python-tests-with-temp-buffer
4342 "
4343data '=' 42
4344"
4345 (python-tests-look-at "data '=' 42")
4346 (should (not (python-info-assignment-statement-p)))
4347 (should (not (python-info-assignment-statement-p t)))))
4348
4276(ert-deftest python-info-assignment-continuation-line-p-1 () 4349(ert-deftest python-info-assignment-continuation-line-p-1 ()
4277 (python-tests-with-temp-buffer 4350 (python-tests-with-temp-buffer
4278 " 4351 "
@@ -4360,6 +4433,136 @@ foo = True # another comment
4360 (forward-line 1) 4433 (forward-line 1)
4361 (should (python-info-current-line-empty-p)))) 4434 (should (python-info-current-line-empty-p))))
4362 4435
4436(ert-deftest python-info-docstring-p-1 ()
4437 "Test module docstring detection."
4438 (python-tests-with-temp-buffer
4439 "# -*- coding: utf-8 -*-
4440#!/usr/bin/python
4441
4442'''
4443Module Docstring Django style.
4444'''
4445u'''Additional module docstring.'''
4446'''Not a module docstring.'''
4447"
4448 (python-tests-look-at "Module Docstring Django style.")
4449 (should (python-info-docstring-p))
4450 (python-tests-look-at "u'''Additional module docstring.'''")
4451 (should (python-info-docstring-p))
4452 (python-tests-look-at "'''Not a module docstring.'''")
4453 (should (not (python-info-docstring-p)))))
4454
4455(ert-deftest python-info-docstring-p-2 ()
4456 "Test variable docstring detection."
4457 (python-tests-with-temp-buffer
4458 "
4459variable = 42
4460U'''Variable docstring.'''
4461'''Additional variable docstring.'''
4462'''Not a variable docstring.'''
4463"
4464 (python-tests-look-at "Variable docstring.")
4465 (should (python-info-docstring-p))
4466 (python-tests-look-at "u'''Additional variable docstring.'''")
4467 (should (python-info-docstring-p))
4468 (python-tests-look-at "'''Not a variable docstring.'''")
4469 (should (not (python-info-docstring-p)))))
4470
4471(ert-deftest python-info-docstring-p-3 ()
4472 "Test function docstring detection."
4473 (python-tests-with-temp-buffer
4474 "
4475def func(a, b):
4476 r'''
4477 Function docstring.
4478
4479 onetwo style.
4480 '''
4481 R'''Additional function docstring.'''
4482 '''Not a function docstring.'''
4483 return a + b
4484"
4485 (python-tests-look-at "Function docstring.")
4486 (should (python-info-docstring-p))
4487 (python-tests-look-at "R'''Additional function docstring.'''")
4488 (should (python-info-docstring-p))
4489 (python-tests-look-at "'''Not a function docstring.'''")
4490 (should (not (python-info-docstring-p)))))
4491
4492(ert-deftest python-info-docstring-p-4 ()
4493 "Test class docstring detection."
4494 (python-tests-with-temp-buffer
4495 "
4496class Class:
4497 ur'''
4498 Class docstring.
4499
4500 symmetric style.
4501 '''
4502 uR'''
4503 Additional class docstring.
4504 '''
4505 '''Not a class docstring.'''
4506 pass
4507"
4508 (python-tests-look-at "Class docstring.")
4509 (should (python-info-docstring-p))
4510 (python-tests-look-at "uR'''") ;; Additional class docstring
4511 (should (python-info-docstring-p))
4512 (python-tests-look-at "'''Not a class docstring.'''")
4513 (should (not (python-info-docstring-p)))))
4514
4515(ert-deftest python-info-docstring-p-5 ()
4516 "Test class attribute docstring detection."
4517 (python-tests-with-temp-buffer
4518 "
4519class Class:
4520 attribute = 42
4521 Ur'''
4522 Class attribute docstring.
4523
4524 pep-257 style.
4525
4526 '''
4527 UR'''
4528 Additional class attribute docstring.
4529 '''
4530 '''Not a class attribute docstring.'''
4531 pass
4532"
4533 (python-tests-look-at "Class attribute docstring.")
4534 (should (python-info-docstring-p))
4535 (python-tests-look-at "UR'''") ;; Additional class attr docstring
4536 (should (python-info-docstring-p))
4537 (python-tests-look-at "'''Not a class attribute docstring.'''")
4538 (should (not (python-info-docstring-p)))))
4539
4540(ert-deftest python-info-docstring-p-6 ()
4541 "Test class method docstring detection."
4542 (python-tests-with-temp-buffer
4543 "
4544class Class:
4545
4546 def __init__(self, a, b):
4547 self.a = a
4548 self.b = b
4549
4550 def __call__(self):
4551 '''Method docstring.
4552
4553 pep-257-nn style.
4554 '''
4555 '''Additional method docstring.'''
4556 '''Not a method docstring.'''
4557 return self.a + self.b
4558"
4559 (python-tests-look-at "Method docstring.")
4560 (should (python-info-docstring-p))
4561 (python-tests-look-at "'''Additional method docstring.'''")
4562 (should (python-info-docstring-p))
4563 (python-tests-look-at "'''Not a method docstring.'''")
4564 (should (not (python-info-docstring-p)))))
4565
4363(ert-deftest python-info-encoding-from-cookie-1 () 4566(ert-deftest python-info-encoding-from-cookie-1 ()
4364 "Should detect it on first line." 4567 "Should detect it on first line."
4365 (python-tests-with-temp-buffer 4568 (python-tests-with-temp-buffer
diff --git a/test/automated/seq-tests.el b/test/automated/seq-tests.el
index d3536b6f9a6..7f6e06cc4b6 100644
--- a/test/automated/seq-tests.el
+++ b/test/automated/seq-tests.el
@@ -250,5 +250,31 @@ Evaluate BODY for each created sequence.
250 (should (same-contents-p list vector)) 250 (should (same-contents-p list vector))
251 (should (vectorp vector)))) 251 (should (vectorp vector))))
252 252
253(ert-deftest test-seq-intersection ()
254 (let ((v1 [2 3 4 5])
255 (v2 [1 3 5 6 7]))
256 (should (same-contents-p (seq-intersection v1 v2)
257 '(3 5))))
258 (let ((l1 '(2 3 4 5))
259 (l2 '(1 3 5 6 7)))
260 (should (same-contents-p (seq-intersection l1 l2)
261 '(3 5))))
262 (let ((v1 [2 4 6])
263 (v2 [1 3 5]))
264 (should (seq-empty-p (seq-intersection v1 v2)))))
265
266(ert-deftest test-seq-difference ()
267 (let ((v1 [2 3 4 5])
268 (v2 [1 3 5 6 7]))
269 (should (same-contents-p (seq-difference v1 v2)
270 '(2 4))))
271 (let ((l1 '(2 3 4 5))
272 (l2 '(1 3 5 6 7)))
273 (should (same-contents-p (seq-difference l1 l2)
274 '(2 4))))
275 (let ((v1 [2 4 6])
276 (v2 [2 4 6]))
277 (should (seq-empty-p (seq-difference v1 v2)))))
278
253(provide 'seq-tests) 279(provide 'seq-tests)
254;;; seq-tests.el ends here 280;;; seq-tests.el ends here
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index cc2c753b9d5..5bb05dce19a 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -981,9 +981,14 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
981This tests also `file-readable-p' and `file-regular-p'." 981This tests also `file-readable-p' and `file-regular-p'."
982 (skip-unless (tramp--test-enabled)) 982 (skip-unless (tramp--test-enabled))
983 983
984 (let ((tmp-name1 (tramp--test-make-temp-name)) 984 ;; We must use `file-truename' for the temporary directory, because
985 (tmp-name2 (tramp--test-make-temp-name)) 985 ;; it could be located on a symlinked directory. This would let the
986 attr) 986 ;; test fail.
987 (let* ((tramp-test-temporary-file-directory
988 (file-truename tramp-test-temporary-file-directory))
989 (tmp-name1 (tramp--test-make-temp-name))
990 (tmp-name2 (tramp--test-make-temp-name))
991 attr)
987 (unwind-protect 992 (unwind-protect
988 (progn 993 (progn
989 (write-region "foo" nil tmp-name1) 994 (write-region "foo" nil tmp-name1)
@@ -1535,9 +1540,14 @@ This requires restrictions of file name syntax."
1535 1540
1536(defun tramp--test-check-files (&rest files) 1541(defun tramp--test-check-files (&rest files)
1537 "Run a simple but comprehensive test over every file in FILES." 1542 "Run a simple but comprehensive test over every file in FILES."
1538 (let ((tmp-name1 (tramp--test-make-temp-name)) 1543 ;; We must use `file-truename' for the temporary directory, because
1539 (tmp-name2 (tramp--test-make-temp-name 'local)) 1544 ;; it could be located on a symlinked directory. This would let the
1540 (files (delq nil files))) 1545 ;; test fail.
1546 (let* ((tramp-test-temporary-file-directory
1547 (file-truename tramp-test-temporary-file-directory))
1548 (tmp-name1 (tramp--test-make-temp-name))
1549 (tmp-name2 (tramp--test-make-temp-name 'local))
1550 (files (delq nil files)))
1541 (unwind-protect 1551 (unwind-protect
1542 (progn 1552 (progn
1543 (make-directory tmp-name1) 1553 (make-directory tmp-name1)
diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css
index 564ac16f954..faf91539d84 100644
--- a/test/indent/css-mode.css
+++ b/test/indent/css-mode.css
@@ -8,6 +8,21 @@ article[role="main"] {
8 width: 60%; 8 width: 60%;
9} 9}
10 10
11a, b:hover, c {
12 color: black;
13}
14
15a, b:hover { /* bug:20282 */
16 c {
17 color: black;
18 }
19 color: black;
20}
21
22a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */
23 background-color: white;
24}
25
11/* asdfasdf */ 26/* asdfasdf */
12@foo x2 { 27@foo x2 {
13 bla:toto; 28 bla:toto;
diff --git a/test/indent/perl.perl b/test/indent/perl.perl
index 00ef312f735..ea487543219 100755
--- a/test/indent/perl.perl
+++ b/test/indent/perl.perl
@@ -5,6 +5,15 @@ sub add_funds($) {
5 return 0; 5 return 0;
6} 6}
7 7
8my $hash = {
9 foo => 'bar',
10 format => 'some',
11};
12
13sub some_code {
14 print "will not indent :(";
15};
16
8use v5.14; 17use v5.14;
9 18
10my $str= <<END; 19my $str= <<END;