diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/file-organization.org | 2 | ||||
| -rw-r--r-- | test/lisp/minibuffer-tests.el | 32 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 32 | ||||
| -rw-r--r-- | test/lisp/progmodes/flymake-resources/test.pl | 2 | ||||
| -rw-r--r-- | test/lisp/progmodes/flymake-resources/test.rb | 5 | ||||
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 27 |
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 | |||
| 30 | 30 | ||
| 31 | Tests should normally reside in a file with ~-tests.el~ added to the | 31 | Tests should normally reside in a file with ~-tests.el~ added to the |
| 32 | base-name of the tested source file; hence ~ert.el~ is tested in | 32 | base-name of the tested source file; hence ~ert.el~ is tested in |
| 33 | ~ert-tests.el~, and ~pcase.el~ is tested in ~pcase-tests.el~. As n | 33 | ~ert-tests.el~, and ~pcase.el~ is tested in ~pcase-tests.el~. As an |
| 34 | exception, tests for a single feature may be placed into multiple | 34 | exception, tests for a single feature may be placed into multiple |
| 35 | files of any name which are themselves placed in a directory named | 35 | files of any name which are themselves placed in a directory named |
| 36 | after the feature with ~-tests~ appended, such as | 36 | 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 @@ | |||
| 42 | (should (equal (buffer-string) | 42 | (should (equal (buffer-string) |
| 43 | "test: ")))))) | 43 | "test: ")))))) |
| 44 | 44 | ||
| 45 | (ert-deftest completion-table-with-predicate-test () | ||
| 46 | (let ((full-collection | ||
| 47 | '("apple" ; Has A. | ||
| 48 | "beet" ; Has B. | ||
| 49 | "banana" ; Has A & B. | ||
| 50 | "cherry" ; Has neither. | ||
| 51 | )) | ||
| 52 | (no-A (lambda (x) (not (string-match-p "a" x)))) | ||
| 53 | (no-B (lambda (x) (not (string-match-p "b" x))))) | ||
| 54 | (should | ||
| 55 | (member "cherry" | ||
| 56 | (completion-table-with-predicate | ||
| 57 | full-collection no-A t "" no-B t))) | ||
| 58 | (should-not | ||
| 59 | (member "banana" | ||
| 60 | (completion-table-with-predicate | ||
| 61 | full-collection no-A t "" no-B t))) | ||
| 62 | ;; "apple" should still match when strict is nil. | ||
| 63 | (should (eq t (try-completion | ||
| 64 | "apple" | ||
| 65 | (apply-partially | ||
| 66 | 'completion-table-with-predicate | ||
| 67 | full-collection no-A nil) | ||
| 68 | no-B))) | ||
| 69 | ;; "apple" should still match when strict is nil and pred2 is nil | ||
| 70 | ;; (Bug#27841). | ||
| 71 | (should (eq t (try-completion | ||
| 72 | "apple" | ||
| 73 | (apply-partially | ||
| 74 | 'completion-table-with-predicate | ||
| 75 | full-collection no-A nil)))))) | ||
| 76 | |||
| 45 | (provide 'completion-tests) | 77 | (provide 'completion-tests) |
| 46 | ;;; completion-tests.el ends here | 78 | ;;; 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'." | |||
| 2290 | 2290 | ||
| 2291 | ;; Cleanup. | 2291 | ;; Cleanup. |
| 2292 | (ignore-errors | 2292 | (ignore-errors |
| 2293 | (delete-directory tmp-name1)))))) | 2293 | (delete-directory tmp-name1 'recursive)))))) |
| 2294 | 2294 | ||
| 2295 | (ert-deftest tramp-test17-insert-directory () | 2295 | (ert-deftest tramp-test17-insert-directory () |
| 2296 | "Check `insert-directory'." | 2296 | "Check `insert-directory'." |
| @@ -4432,23 +4432,27 @@ process sentinels. They shall not disturb each other." | |||
| 4432 | "Check that Tramp is loaded lazily, only when needed." | 4432 | "Check that Tramp is loaded lazily, only when needed." |
| 4433 | ;; Tramp is neither loaded at Emacs startup, nor when completing a | 4433 | ;; Tramp is neither loaded at Emacs startup, nor when completing a |
| 4434 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file | 4434 | ;; non-Tramp file name like "/foo". Completing a Tramp-alike file |
| 4435 | ;; name like "/foo:" autoloads Tramp. | 4435 | ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. |
| 4436 | (let ((code | 4436 | (let ((code |
| 4437 | "(progn \ | 4437 | "(progn \ |
| 4438 | (message \"Tramp loaded: %s\" (featurep 'tramp)) \ | 4438 | (setq tramp-mode %s) \ |
| 4439 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ | ||
| 4439 | (file-name-all-completions \"/foo\" \"/\") \ | 4440 | (file-name-all-completions \"/foo\" \"/\") \ |
| 4440 | (message \"Tramp loaded: %s\" (featurep 'tramp)) \ | 4441 | (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ |
| 4441 | (file-name-all-completions \"/foo:\" \"/\") \ | 4442 | (file-name-all-completions \"/foo:\" \"/\") \ |
| 4442 | (message \"Tramp loaded: %s\" (featurep 'tramp)))")) | 4443 | (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) |
| 4443 | (should | 4444 | (dolist (tm '(t nil)) |
| 4444 | (string-match | 4445 | (should |
| 4445 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: t[\n\r]+" | 4446 | (string-match |
| 4446 | (shell-command-to-string | 4447 | (format |
| 4447 | (format | 4448 | "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: %s[\n\r]+" |
| 4448 | "%s -batch -Q -L %s --eval %s" | 4449 | tm) |
| 4449 | (expand-file-name invocation-name invocation-directory) | 4450 | (shell-command-to-string |
| 4450 | (mapconcat 'shell-quote-argument load-path " -L ") | 4451 | (format |
| 4451 | (shell-quote-argument code))))))) | 4452 | "%s -batch -Q -L %s --eval %s" |
| 4453 | (expand-file-name invocation-name invocation-directory) | ||
| 4454 | (mapconcat 'shell-quote-argument load-path " -L ") | ||
| 4455 | (shell-quote-argument (format code tm))))))))) | ||
| 4452 | 4456 | ||
| 4453 | (ert-deftest tramp-test43-unload () | 4457 | (ert-deftest tramp-test43-unload () |
| 4454 | "Check that Tramp and its subpackages unload completely. | 4458 | "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 @@ | |||
| 1 | @arr = [1,2,3,4]; | 1 | @arr = [1,2,3,4]; |
| 2 | unknown; | ||
| 2 | my $b = @arr[1]; | 3 | my $b = @arr[1]; |
| 4 | [ | ||
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 @@ | |||
| 1 | def bla | ||
| 2 | return 2 | ||
| 3 | print "not reached" | ||
| 4 | something | ||
| 5 | 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 | |||
| 108 | (should (eq 'flymake-warning | 108 | (should (eq 'flymake-warning |
| 109 | (face-at-point))))) | 109 | (face-at-point))))) |
| 110 | 110 | ||
| 111 | (ert-deftest warning-predicate-rx-perl () | 111 | (ert-deftest perl-backend () |
| 112 | "Test perl warning via regular expression predicate." | 112 | "Test the perl backend" |
| 113 | (skip-unless (executable-find "perl")) | 113 | (skip-unless (executable-find "perl")) |
| 114 | (flymake-tests--with-flymake | 114 | (flymake-tests--with-flymake ("test.pl") |
| 115 | ("test.pl" :severity-predicate "^Scalar value") | ||
| 116 | (flymake-goto-next-error) | 115 | (flymake-goto-next-error) |
| 117 | (should (eq 'flymake-warning | 116 | (should (eq 'flymake-warning (face-at-point))) |
| 118 | (face-at-point))))) | 117 | (flymake-goto-next-error) |
| 118 | (should (eq 'flymake-error (face-at-point))))) | ||
| 119 | 119 | ||
| 120 | (ert-deftest warning-predicate-function-perl () | 120 | (ert-deftest ruby-backend () |
| 121 | "Test perl warning via function predicate." | 121 | "Test the ruby backend" |
| 122 | (skip-unless (executable-find "perl")) | 122 | (skip-unless (executable-find "ruby")) |
| 123 | (flymake-tests--with-flymake | 123 | (flymake-tests--with-flymake ("test.rb") |
| 124 | ("test.pl" :severity-predicate | ||
| 125 | (lambda (msg) (string-match "^Scalar value" msg))) | ||
| 126 | (flymake-goto-next-error) | 124 | (flymake-goto-next-error) |
| 127 | (should (eq 'flymake-warning | 125 | (should (eq 'flymake-warning (face-at-point))) |
| 128 | (face-at-point))))) | 126 | (flymake-goto-next-error) |
| 127 | (should (eq 'flymake-error (face-at-point))))) | ||
| 129 | 128 | ||
| 130 | (ert-deftest different-diagnostic-types () | 129 | (ert-deftest different-diagnostic-types () |
| 131 | "Test GCC warning via function predicate." | 130 | "Test GCC warning via function predicate." |