summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-11-08 19:22:26 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2017-11-08 19:22:26 -0800
commit6ee827059463e4b95c9251ef22a21f9c67cf668d (patch)
tree0612e1b84922cc43eeed5ea219104d4c5985cbdf /test
parent83dc3f0e9b518e45bcfb0aaebcc706f79622f157 (diff)
parent255ba01148f69f452937e67feb7af5d4c1466fed (diff)
downloademacs-6ee827059463e4b95c9251ef22a21f9c67cf668d.tar.gz
Merge from origin/emacs-26
255ba01148 Fix handling of nil PRED2 arg for completion-table-with-pr... 949b70a7d8 ; Minor comment copyedit in window.c 20f9bf30f0 Describe Lao rendering problem 3d61657694 Fix docstring of arabic-shaper-ZWNJ-handling db949166ec Handle single-line comments correctly (Bug#26049) 795bb233a5 * test/lisp/net/tramp-tests.el (tramp-test16-file-expand-w... ba00ea7d0d * etc/PROBLEMS: Add URL to relevant issues for xterm+evil bug 4a6015811e ; In text.texi fix typo spotted by Štěpán Němec 93cd8415b2 Document new treatment of 'comment-auto-fill-only-comments' ca2d94ba61 Do not load Tramp unless `tramp-mode' is non-nil 709478eaa8 Prefer `customize-set-variable' in tramp.texi 5d36f2227f Fix last change in hscroll_window_tree 72d07d1950 Ediff: add some missing documentation 18af404ef3 Support python virtualenv on w32 (Bug#24464) efd0371c23 Improve dired deletion error handling (Bug#28797) 5d744e032f Don't replace user input when completion prefix is empty (... ec6cf35c5f ; Describe xt-mouse problems with Evil mode c572e1f329 Return non-nil from gnutls-available-p under GnuTLS 2.x a2cc6d74c5 Fix Flymake help-echo functions across windows (bug#29142) 58bb3462ee Add tests for Flymake backends for Ruby and Perl 58e742b21d Add a Flymake backend for Perl 9dee764165 Add a Flymake backend for Ruby 3ad712ebc9 Add a Flymake backend for Python (bug#28808) 8db2b3a79b Allow "%" in Tramp host names 8c50842790 ; Fix typo in test/file-organization.org 00fa4449cd ; Fix typo 918a2dda07 Use hybrid malloc for FreeBSD (Bug#28308) 725ab635d9 Add html-, mhtml- and python-mode support to semantic symref 369da28702 Improve documentation of 'window-scroll-functions' 93818eed8a Fix subtle problems in tabulated-list-mode with line numbers 1f1de8e872 Make gdb-non-stop-setting default to nil on MS-Windows 680e8e119b Fix gdb-mi prompt after "attach PID" command ff33074546 Fix doc string of 'window-configuration-change-hook' 787b75ad71 Improve documentation of window hooks d9be8704ae Fix hscroll suspension after cursor motion 6f43d29d29 ; * CONTRIBUTE, admin/make-tarball.txt: Doc tweaks re 'ema... a0d30d6369 Introduce a function to CC Mode which displays the current... 383abc8898 ; Fix some comment typos b02c2714c3 Fix typos in ediff-wind.el 4f38bdec74 Examine tex-chktex--process in the correct buffer 94b490529a * nt/INSTALL.W64: Update to current mingw64 install instru... c25113d4ac Don't resignal errors in flymake-diag-region e950f329c0 New xref-quit-and-goto-xref command bound to TAB (bug#28814) 5d34e1b288 Allow split-window-sensibly to split threshold in further ... 2a973edeac Honor window-switching intents in xref-find-definitions (b... 78e9065e9f * lisp/emacs-lisp/generator.el (iter-do): Add a debug decl... caa63cc96c * lisp/progmodes/flymake.el (flymake-start): Fix dead buff... 9f4f130b79 Fix buffer name comparison in async shell-command # Conflicts: # etc/NEWS # lisp/vc/ediff-wind.el
Diffstat (limited to 'test')
-rw-r--r--test/file-organization.org2
-rw-r--r--test/lisp/minibuffer-tests.el32
-rw-r--r--test/lisp/net/tramp-tests.el32
-rw-r--r--test/lisp/progmodes/flymake-resources/test.pl2
-rw-r--r--test/lisp/progmodes/flymake-resources/test.rb5
-rw-r--r--test/lisp/progmodes/flymake-tests.el27
6 files changed, 71 insertions, 29 deletions
diff --git a/test/file-organization.org b/test/file-organization.org
index 4d76c0068e3..6c93c28c8e1 100644
--- a/test/file-organization.org
+++ b/test/file-organization.org
@@ -30,7 +30,7 @@ the directory structure of the source tree; so tests for files in the
Tests should normally reside in a file with ~-tests.el~ added to the
base-name of the tested source file; hence ~ert.el~ is tested in
-~ert-tests.el~, and ~pcase.el~ is tested in ~pcase-tests.el~. As n
+~ert-tests.el~, and ~pcase.el~ is tested in ~pcase-tests.el~. As an
exception, tests for a single feature may be placed into multiple
files of any name which are themselves placed in a directory named
after the feature with ~-tests~ appended, such as
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index c27b338f7f3..2d2ac85e3ff 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -42,5 +42,37 @@
(should (equal (buffer-string)
"test: "))))))
+(ert-deftest completion-table-with-predicate-test ()
+ (let ((full-collection
+ '("apple" ; Has A.
+ "beet" ; Has B.
+ "banana" ; Has A & B.
+ "cherry" ; Has neither.
+ ))
+ (no-A (lambda (x) (not (string-match-p "a" x))))
+ (no-B (lambda (x) (not (string-match-p "b" x)))))
+ (should
+ (member "cherry"
+ (completion-table-with-predicate
+ full-collection no-A t "" no-B t)))
+ (should-not
+ (member "banana"
+ (completion-table-with-predicate
+ full-collection no-A t "" no-B t)))
+ ;; "apple" should still match when strict is nil.
+ (should (eq t (try-completion
+ "apple"
+ (apply-partially
+ 'completion-table-with-predicate
+ full-collection no-A nil)
+ no-B)))
+ ;; "apple" should still match when strict is nil and pred2 is nil
+ ;; (Bug#27841).
+ (should (eq t (try-completion
+ "apple"
+ (apply-partially
+ 'completion-table-with-predicate
+ full-collection no-A nil))))))
+
(provide 'completion-tests)
;;; completion-tests.el ends here
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index af707f85007..5a7134f5f53 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2290,7 +2290,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
;; Cleanup.
(ignore-errors
- (delete-directory tmp-name1))))))
+ (delete-directory tmp-name1 'recursive))))))
(ert-deftest tramp-test17-insert-directory ()
"Check `insert-directory'."
@@ -4432,23 +4432,27 @@ process sentinels. They shall not disturb each other."
"Check that Tramp is loaded lazily, only when needed."
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
- ;; name like "/foo:" autoloads Tramp.
+ ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t.
(let ((code
"(progn \
- (message \"Tramp loaded: %s\" (featurep 'tramp)) \
+ (setq tramp-mode %s) \
+ (message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo\" \"/\") \
- (message \"Tramp loaded: %s\" (featurep 'tramp)) \
+ (message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo:\" \"/\") \
- (message \"Tramp loaded: %s\" (featurep 'tramp)))"))
- (should
- (string-match
- "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: t[\n\r]+"
- (shell-command-to-string
- (format
- "%s -batch -Q -L %s --eval %s"
- (expand-file-name invocation-name invocation-directory)
- (mapconcat 'shell-quote-argument load-path " -L ")
- (shell-quote-argument code)))))))
+ (message \"Tramp loaded: %%s\" (featurep 'tramp)))"))
+ (dolist (tm '(t nil))
+ (should
+ (string-match
+ (format
+ "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+"
+ tm)
+ (shell-command-to-string
+ (format
+ "%s -batch -Q -L %s --eval %s"
+ (expand-file-name invocation-name invocation-directory)
+ (mapconcat 'shell-quote-argument load-path " -L ")
+ (shell-quote-argument (format code tm)))))))))
(ert-deftest tramp-test43-unload ()
"Check that Tramp and its subpackages unload completely.
diff --git a/test/lisp/progmodes/flymake-resources/test.pl b/test/lisp/progmodes/flymake-resources/test.pl
index d5abcb47e7f..6f4f1ccef50 100644
--- a/test/lisp/progmodes/flymake-resources/test.pl
+++ b/test/lisp/progmodes/flymake-resources/test.pl
@@ -1,2 +1,4 @@
@arr = [1,2,3,4];
+unknown;
my $b = @arr[1];
+[
diff --git a/test/lisp/progmodes/flymake-resources/test.rb b/test/lisp/progmodes/flymake-resources/test.rb
new file mode 100644
index 00000000000..1419eaf3ad2
--- /dev/null
+++ b/test/lisp/progmodes/flymake-resources/test.rb
@@ -0,0 +1,5 @@
+def bla
+ return 2
+ print "not reached"
+ something
+ oops
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el
index cfa810053ca..c60f9100345 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -108,24 +108,23 @@ SEVERITY-PREDICATE is used to setup
(should (eq 'flymake-warning
(face-at-point)))))
-(ert-deftest warning-predicate-rx-perl ()
- "Test perl warning via regular expression predicate."
+(ert-deftest perl-backend ()
+ "Test the perl backend"
(skip-unless (executable-find "perl"))
- (flymake-tests--with-flymake
- ("test.pl" :severity-predicate "^Scalar value")
+ (flymake-tests--with-flymake ("test.pl")
(flymake-goto-next-error)
- (should (eq 'flymake-warning
- (face-at-point)))))
+ (should (eq 'flymake-warning (face-at-point)))
+ (flymake-goto-next-error)
+ (should (eq 'flymake-error (face-at-point)))))
-(ert-deftest warning-predicate-function-perl ()
- "Test perl warning via function predicate."
- (skip-unless (executable-find "perl"))
- (flymake-tests--with-flymake
- ("test.pl" :severity-predicate
- (lambda (msg) (string-match "^Scalar value" msg)))
+(ert-deftest ruby-backend ()
+ "Test the ruby backend"
+ (skip-unless (executable-find "ruby"))
+ (flymake-tests--with-flymake ("test.rb")
(flymake-goto-next-error)
- (should (eq 'flymake-warning
- (face-at-point)))))
+ (should (eq 'flymake-warning (face-at-point)))
+ (flymake-goto-next-error)
+ (should (eq 'flymake-error (face-at-point)))))
(ert-deftest different-diagnostic-types ()
"Test GCC warning via function predicate."