aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlan Mackenzie2016-03-30 16:53:36 +0000
committerAlan Mackenzie2016-03-30 16:53:36 +0000
commited19f207449c43f7f08285ada87ae7a46c61c8d1 (patch)
treefc495d64b752f276f1e8dc86427098de80789988 /test
parenteabd667a9584fe5bd2422e296d256dceea67debf (diff)
parent7c1802f6ffc2704ba8042c7c1c6faa73dfa210d1 (diff)
downloademacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.tar.gz
emacs-ed19f207449c43f7f08285ada87ae7a46c61c8d1.zip
Merge branch 'emacs-25' of /home/acm/emacs/emacs.git/emacs-25 into emacs-25
Diffstat (limited to 'test')
-rw-r--r--test/automated/map-tests.el9
-rw-r--r--test/automated/package-test.el2
-rw-r--r--test/automated/ruby-mode-tests.el8
-rw-r--r--test/automated/tramp-tests.el13
-rw-r--r--test/automated/xt-mouse-tests.el110
-rw-r--r--test/indent/ruby.rb47
6 files changed, 183 insertions, 6 deletions
diff --git a/test/automated/map-tests.el b/test/automated/map-tests.el
index d145c197a4e..20cb0f6b399 100644
--- a/test/automated/map-tests.el
+++ b/test/automated/map-tests.el
@@ -87,9 +87,16 @@ Evaluate BODY for each created map.
87 (let ((vec [3 4 5])) 87 (let ((vec [3 4 5]))
88 (should-error (setf (map-elt vec 3) 6)))) 88 (should-error (setf (map-elt vec 3) 6))))
89 89
90(ert-deftest test-map-put-alist-new-key ()
91 "Regression test for Bug#23105."
92 (let ((alist '((0 . a))))
93 (map-put alist 2 'b)
94 (should (eq (map-elt alist 2)
95 'b))))
96
90(ert-deftest test-map-put-return-value () 97(ert-deftest test-map-put-return-value ()
91 (let ((ht (make-hash-table))) 98 (let ((ht (make-hash-table)))
92 (should (eq (map-put ht 'a 'hello) ht)))) 99 (should (eq (map-put ht 'a 'hello) 'hello))))
93 100
94(ert-deftest test-map-delete () 101(ert-deftest test-map-delete ()
95 (with-maps-do map 102 (with-maps-do map
diff --git a/test/automated/package-test.el b/test/automated/package-test.el
index e10946efa96..55806454741 100644
--- a/test/automated/package-test.el
+++ b/test/automated/package-test.el
@@ -466,7 +466,7 @@ Must called from within a `tar-mode' buffer."
466 (cons (format "HOME=%s" homedir) 466 (cons (format "HOME=%s" homedir)
467 process-environment))) 467 process-environment)))
468 (epg-check-configuration (epg-configuration)) 468 (epg-check-configuration (epg-configuration))
469 t) 469 (epg-find-configuration 'OpenPGP))
470 (delete-directory homedir t))))) 470 (delete-directory homedir t)))))
471 (let* ((keyring (expand-file-name "key.pub" package-test-data-dir)) 471 (let* ((keyring (expand-file-name "key.pub" package-test-data-dir))
472 (package-test-data-dir 472 (package-test-data-dir
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
index 4fa7470218a..7e85fb83edd 100644
--- a/test/automated/ruby-mode-tests.el
+++ b/test/automated/ruby-mode-tests.el
@@ -449,6 +449,14 @@ VALUES-PLIST is a list with alternating index and value elements."
449 ;; It's confused by the closing paren in the middle. 449 ;; It's confused by the closing paren in the middle.
450 (ruby-assert-state s 8 nil))) 450 (ruby-assert-state s 8 nil)))
451 451
452(ert-deftest ruby-interpolation-inside-another-interpolation ()
453 :expected-result :failed
454 (let ((s "\"#{[a, b, c].map { |v| \"#{v}\" }.join}\""))
455 (ruby-assert-face s 1 font-lock-string-face)
456 (ruby-assert-face s 2 font-lock-variable-name-face)
457 (ruby-assert-face s 38 font-lock-string-face)
458 (ruby-assert-state s 8 nil)))
459
452(ert-deftest ruby-interpolation-inside-double-quoted-percent-literals () 460(ert-deftest ruby-interpolation-inside-double-quoted-percent-literals ()
453 (ruby-assert-face "%Q{foo #@bar}" 8 font-lock-variable-name-face) 461 (ruby-assert-face "%Q{foo #@bar}" 8 font-lock-variable-name-face)
454 (ruby-assert-face "%W{foo #@bar}" 8 font-lock-variable-name-face) 462 (ruby-assert-face "%W{foo #@bar}" 8 font-lock-variable-name-face)
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index a29e42e7343..d9563ec9174 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -1785,6 +1785,14 @@ Several special characters do not work properly there."
1785 (file-truename tramp-test-temporary-file-directory) nil 1785 (file-truename tramp-test-temporary-file-directory) nil
1786 (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) 1786 (string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
1787 1787
1788(defun tramp--test-darwin-p ()
1789 "Check, whether the remote host runs Mac OS X.
1790Several special characters do not work properly there."
1791 ;; We must refill the cache. `file-truename' does it.
1792 (with-parsed-tramp-file-name
1793 (file-truename tramp-test-temporary-file-directory) nil
1794 (string-match "^Darwin" (tramp-get-connection-property v "uname" ""))))
1795
1788(defun tramp--test-check-files (&rest files) 1796(defun tramp--test-check-files (&rest files)
1789 "Run a simple but comprehensive test over every file in FILES." 1797 "Run a simple but comprehensive test over every file in FILES."
1790 ;; We must use `file-truename' for the temporary directory, because 1798 ;; We must use `file-truename' for the temporary directory, because
@@ -2038,9 +2046,10 @@ Use the `ls' command."
2038 (file-name-coding-system 'utf-8)) 2046 (file-name-coding-system 'utf-8))
2039 (tramp--test-check-files 2047 (tramp--test-check-files
2040 (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") 2048 (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ")
2041 (unless (tramp--test-hpux-p) 2049 (unless (or (tramp--test-hpux-p) (tramp--test-darwin-p))
2042 "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") 2050 "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت")
2043 "银河系漫游指南系列" 2051 (unless (tramp--test-darwin-p)
2052 "银河系漫游指南系列")
2044 "Автостопом по гала́ктике"))) 2053 "Автостопом по гала́ктике")))
2045 2054
2046(ert-deftest tramp-test32-utf8 () 2055(ert-deftest tramp-test32-utf8 ()
diff --git a/test/automated/xt-mouse-tests.el b/test/automated/xt-mouse-tests.el
new file mode 100644
index 00000000000..c7e835c0311
--- /dev/null
+++ b/test/automated/xt-mouse-tests.el
@@ -0,0 +1,110 @@
1;;; xt-mouse-tests.el --- Test suite for xt-mouse. -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5;; Author: Philipp Stephani <phst@google.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;;; Code:
25
26(require 'xt-mouse)
27
28(defmacro with-xterm-mouse-mode (&rest body)
29 "Run BODY with `xterm-mouse-mode' temporarily enabled."
30 (declare (indent 0))
31 ;; Make the frame huge so that the test input events below don't hit
32 ;; the menu bar.
33 `(cl-letf (((frame-width nil) 2000)
34 ((frame-height nil) 2000)
35 ;; Reset XTerm parameters so that the tests don't get
36 ;; confused.
37 ((terminal-parameter nil 'xterm-mouse-x) nil)
38 ((terminal-parameter nil 'xterm-mouse-y) nil)
39 ((terminal-parameter nil 'xterm-mouse-last-down) nil)
40 ((terminal-parameter nil 'xterm-mouse-last-click) nil))
41 (if xterm-mouse-mode
42 (progn ,@body)
43 (unwind-protect
44 (progn
45 ;; `xterm-mouse-mode' doesn't work in the initial
46 ;; terminal. Since we can't create a second terminal in
47 ;; batch mode, fake it temporarily.
48 (cl-letf (((symbol-function 'terminal-name)
49 (lambda (&optional _terminal) "fake-terminal")))
50 (xterm-mouse-mode))
51 ,@body)
52 (xterm-mouse-mode 0)))))
53
54(ert-deftest xt-mouse-tracking-basic ()
55 (should (equal (xterm-mouse-tracking-enable-sequence)
56 "\e[?1000h\e[?1002h\e[?1006h"))
57 (should (equal (xterm-mouse-tracking-disable-sequence)
58 "\e[?1006l\e[?1002l\e[?1000l"))
59 (with-xterm-mouse-mode
60 (should xterm-mouse-mode)
61 (should (terminal-parameter nil 'xterm-mouse-mode))
62 (should-not (terminal-parameter nil 'xterm-mouse-utf-8))
63 (let* ((unread-command-events (append "\e[M%\xD9\x81"
64 "\e[M'\xD9\x81" nil))
65 (key (read-key)))
66 (should (consp key))
67 (cl-destructuring-bind (event-type position . rest) key
68 (should (equal event-type 'S-mouse-2))
69 (should (consp position))
70 (cl-destructuring-bind (_ _ xy . rest) position
71 (should (equal xy '(184 . 95))))))))
72
73(ert-deftest xt-mouse-tracking-utf-8 ()
74 (let ((xterm-mouse-utf-8 t))
75 (should (equal (xterm-mouse-tracking-enable-sequence)
76 "\e[?1000h\e[?1002h\e[?1005h\e[?1006h"))
77 (should (equal (xterm-mouse-tracking-disable-sequence)
78 "\e[?1006l\e[?1005l\e[?1002l\e[?1000l"))
79 (with-xterm-mouse-mode
80 (should xterm-mouse-mode)
81 (should (terminal-parameter nil 'xterm-mouse-mode))
82 (should (terminal-parameter nil 'xterm-mouse-utf-8))
83 ;; The keyboard driver doesn't decode bytes in
84 ;; `unread-command-events'.
85 (let* ((unread-command-events (append "\e[M%\u0640\u0131"
86 "\e[M'\u0640\u0131" nil))
87 (key (read-key)))
88 (should (consp key))
89 (cl-destructuring-bind (event-type position . rest) key
90 (should (equal event-type 'S-mouse-2))
91 (should (consp position))
92 (cl-destructuring-bind (_ _ xy . rest) position
93 (should (equal xy '(1567 . 271)))))))))
94
95(ert-deftest xt-mouse-tracking-sgr ()
96 (with-xterm-mouse-mode
97 (should xterm-mouse-mode)
98 (should (terminal-parameter nil 'xterm-mouse-mode))
99 (should-not (terminal-parameter nil 'xterm-mouse-utf-8))
100 (let* ((unread-command-events (append "\e[<5;1569;273;M"
101 "\e[<5;1569;273;m" nil))
102 (key (read-key)))
103 (should (consp key))
104 (cl-destructuring-bind (event-type position . rest) key
105 (should (equal event-type 'S-mouse-2))
106 (should (consp position))
107 (cl-destructuring-bind (_ _ xy . rest) position
108 (should (equal xy '(1568 . 271))))))))
109
110;;; xt-mouse-tests.el ends here
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 51923f79373..b038512b114 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -222,7 +222,7 @@ foo.
222 bar 222 bar
223 223
224# https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206 224# https://github.com/rails/rails/blob/17f5d8e062909f1fcae25351834d8e89967b645e/activesupport/lib/active_support/time_with_zone.rb#L206
225foo 225foo # comment intended to confuse the tokenizer
226 .bar 226 .bar
227 227
228z = { 228z = {
@@ -295,10 +295,31 @@ foo > bar &&
295 tee < qux 295 tee < qux
296 296
297zux do 297zux do
298 foo == bar and 298 foo == bar &&
299 tee == qux 299 tee == qux
300
301 a = 3 and
302 b = 4
300end 303end
301 304
305foo + bar ==
306 tee + qux
307
3081 .. 2 &&
309 3
310
3113 < 4 +
312 5
313
31410 << 4 ^
315 20
316
317100 + 2 >>
318 3
319
3202 ** 10 /
321 2
322
302foo ^ 323foo ^
303 bar 324 bar
304 325
@@ -317,6 +338,11 @@ def bar
317 .baz 338 .baz
318end 339end
319 340
341abc(foo
342 .bar,
343 tee
344 .qux)
345
320# http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation 346# http://stackoverflow.com/questions/17786563/emacs-ruby-mode-if-expressions-indentation
321tee = if foo 347tee = if foo
322 bar 348 bar
@@ -400,6 +426,17 @@ zoo
400a.records().map(&:b).zip( 426a.records().map(&:b).zip(
401 foo) 427 foo)
402 428
429foo1 =
430 subject.update(
431 1
432 )
433
434foo2 =
435 subject.
436 update(
437 2
438 )
439
403# FIXME: This is not consistent with the example below it, but this 440# FIXME: This is not consistent with the example below it, but this
404# offset only happens if the colon is at eol, which wouldn't be often. 441# offset only happens if the colon is at eol, which wouldn't be often.
405# Tokenizing `bar:' as `:bar =>' would be better, but it's hard to 442# Tokenizing `bar:' as `:bar =>' would be better, but it's hard to
@@ -410,6 +447,12 @@ foo(bar:
410foo(:bar => 447foo(:bar =>
411 tee) 448 tee)
412 449
450regions = foo(
451 OpenStruct.new(id: 0, name: "foo") => [
452 10
453 ]
454)
455
413{'a' => { 456{'a' => {
414 'b' => 'c', 457 'b' => 'c',
415 'd' => %w(e f) 458 'd' => %w(e f)