aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAndrea Corallo2021-04-05 21:00:18 +0200
committerAndrea Corallo2021-04-05 21:00:18 +0200
commit74b58f28ecbc6fe9d7a60c96c79acfdf2329ff73 (patch)
treeb1e99508f836a1d12d17eb3072e14b0cfb2ba407 /test
parent0a3e715e1f5e13874139b4678375b8f5704b800b (diff)
parent14d295871a93c37a33d558ec4e8d49a93b787d8e (diff)
downloademacs-74b58f28ecbc6fe9d7a60c96c79acfdf2329ff73.tar.gz
emacs-74b58f28ecbc6fe9d7a60c96c79acfdf2329ff73.zip
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test')
-rw-r--r--test/infra/Dockerfile.emba2
-rw-r--r--test/lisp/electric-tests.el90
-rw-r--r--test/lisp/epg-config-tests.el47
-rw-r--r--test/lisp/filenotify-tests.el3
-rw-r--r--test/lisp/progmodes/executable-tests.el51
-rw-r--r--test/lisp/progmodes/xref-tests.el2
-rw-r--r--test/src/thread-tests.el6
7 files changed, 150 insertions, 51 deletions
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba
index 30a58971340..19c83a8016f 100644
--- a/test/infra/Dockerfile.emba
+++ b/test/infra/Dockerfile.emba
@@ -68,5 +68,5 @@ COPY . /checkout
68WORKDIR /checkout 68WORKDIR /checkout
69RUN ./autogen.sh autoconf 69RUN ./autogen.sh autoconf
70RUN ./configure --with-ns 70RUN ./configure --with-ns
71RUN make -j4 bootstrap 71RUN make bootstrap
72RUN make -j4 72RUN make -j4
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 44b3d8b672f..235c02f8e8b 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -47,7 +47,7 @@
47 47
48(defmacro save-electric-modes (&rest body) 48(defmacro save-electric-modes (&rest body)
49 (declare (indent defun) (debug t)) 49 (declare (indent defun) (debug t))
50 `(call-with-saved-electric-modes #'(lambda () ,@body))) 50 `(call-with-saved-electric-modes (lambda () ,@body)))
51 51
52(defun electric-pair-test-for (fixture where char expected-string 52(defun electric-pair-test-for (fixture where char expected-string
53 expected-point mode bindings 53 expected-point mode bindings
@@ -359,7 +359,7 @@ baz\"\""
359# \" 359# \"
360# 360#
361baz\"\"" 361baz\"\""
362 :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar"))) 362 :fixture-fn (lambda () (goto-char (point-min)) (search-forward "bar")))
363 363
364(define-electric-pair-test inhibit-in-mismatched-string-inside-c-comments 364(define-electric-pair-test inhibit-in-mismatched-string-inside-c-comments
365 "foo\"\"/* 365 "foo\"\"/*
@@ -378,7 +378,7 @@ baz\"\""
378 \" \" 378 \" \"
379 \" 379 \"
380*/baz\"\"" 380*/baz\"\""
381 :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar"))) 381 :fixture-fn (lambda () (goto-char (point-min)) (search-forward "bar")))
382 382
383 383
384;;; More quotes, but now don't bind `electric-pair-text-syntax-table' 384;;; More quotes, but now don't bind `electric-pair-text-syntax-table'
@@ -520,8 +520,8 @@ baz\"\""
520(define-electric-pair-test js-mode-braces 520(define-electric-pair-test js-mode-braces
521 "" "{" :expected-string "{}" :expected-point 2 521 "" "{" :expected-string "{}" :expected-point 2
522 :modes '(js-mode) 522 :modes '(js-mode)
523 :fixture-fn #'(lambda () 523 :fixture-fn (lambda ()
524 (electric-pair-mode 1))) 524 (electric-pair-mode 1)))
525 525
526 526
527(define-electric-pair-test js-mode-braces-with-layout 527(define-electric-pair-test js-mode-braces-with-layout
@@ -529,29 +529,29 @@ baz\"\""
529 :modes '(js-mode) 529 :modes '(js-mode)
530 :test-in-comments nil 530 :test-in-comments nil
531 :test-in-strings nil 531 :test-in-strings nil
532 :fixture-fn #'(lambda () 532 :fixture-fn (lambda ()
533 (electric-layout-mode 1) 533 (electric-layout-mode 1)
534 (electric-pair-mode 1))) 534 (electric-pair-mode 1)))
535 535
536(define-electric-pair-test js-mode-braces-with-layout-and-indent 536(define-electric-pair-test js-mode-braces-with-layout-and-indent
537 "" "{" :expected-string "{\n \n}" :expected-point 7 537 "" "{" :expected-string "{\n \n}" :expected-point 7
538 :modes '(js-mode) 538 :modes '(js-mode)
539 :test-in-comments nil 539 :test-in-comments nil
540 :test-in-strings nil 540 :test-in-strings nil
541 :fixture-fn #'(lambda () 541 :fixture-fn (lambda ()
542 (electric-pair-mode 1) 542 (electric-pair-mode 1)
543 (electric-indent-mode 1) 543 (electric-indent-mode 1)
544 (electric-layout-mode 1))) 544 (electric-layout-mode 1)))
545 545
546(define-electric-pair-test js-mode-braces-with-layout-and-indent 546(define-electric-pair-test js-mode-braces-with-layout-and-indent
547 "" "{" :expected-string "{\n \n}" :expected-point 7 547 "" "{" :expected-string "{\n \n}" :expected-point 7
548 :modes '(js-mode) 548 :modes '(js-mode)
549 :test-in-comments nil 549 :test-in-comments nil
550 :test-in-strings nil 550 :test-in-strings nil
551 :fixture-fn #'(lambda () 551 :fixture-fn (lambda ()
552 (electric-pair-mode 1) 552 (electric-pair-mode 1)
553 (electric-indent-mode 1) 553 (electric-indent-mode 1)
554 (electric-layout-mode 1))) 554 (electric-layout-mode 1)))
555 555
556 556
557;;; Backspacing 557;;; Backspacing
@@ -606,55 +606,55 @@ baz\"\""
606;;; 606;;;
607(define-electric-pair-test autowrapping-1 607(define-electric-pair-test autowrapping-1
608 "foo" "(" :expected-string "(foo)" :expected-point 2 608 "foo" "(" :expected-string "(foo)" :expected-point 2
609 :fixture-fn #'(lambda () 609 :fixture-fn (lambda ()
610 (electric-pair-mode 1) 610 (electric-pair-mode 1)
611 (mark-sexp 1))) 611 (mark-sexp 1)))
612 612
613(define-electric-pair-test autowrapping-2 613(define-electric-pair-test autowrapping-2
614 "foo" ")" :expected-string "(foo)" :expected-point 6 614 "foo" ")" :expected-string "(foo)" :expected-point 6
615 :fixture-fn #'(lambda () 615 :fixture-fn (lambda ()
616 (electric-pair-mode 1) 616 (electric-pair-mode 1)
617 (mark-sexp 1))) 617 (mark-sexp 1)))
618 618
619(define-electric-pair-test autowrapping-3 619(define-electric-pair-test autowrapping-3
620 "foo" ")" :expected-string "(foo)" :expected-point 6 620 "foo" ")" :expected-string "(foo)" :expected-point 6
621 :fixture-fn #'(lambda () 621 :fixture-fn (lambda ()
622 (electric-pair-mode 1) 622 (electric-pair-mode 1)
623 (goto-char (point-max)) 623 (goto-char (point-max))
624 (skip-chars-backward "\"") 624 (skip-chars-backward "\"")
625 (mark-sexp -1))) 625 (mark-sexp -1)))
626 626
627(define-electric-pair-test autowrapping-4 627(define-electric-pair-test autowrapping-4
628 "foo" "(" :expected-string "(foo)" :expected-point 2 628 "foo" "(" :expected-string "(foo)" :expected-point 2
629 :fixture-fn #'(lambda () 629 :fixture-fn (lambda ()
630 (electric-pair-mode 1) 630 (electric-pair-mode 1)
631 (goto-char (point-max)) 631 (goto-char (point-max))
632 (skip-chars-backward "\"") 632 (skip-chars-backward "\"")
633 (mark-sexp -1))) 633 (mark-sexp -1)))
634 634
635(define-electric-pair-test autowrapping-5 635(define-electric-pair-test autowrapping-5
636 "foo" "\"" :expected-string "\"foo\"" :expected-point 2 636 "foo" "\"" :expected-string "\"foo\"" :expected-point 2
637 :fixture-fn #'(lambda () 637 :fixture-fn (lambda ()
638 (electric-pair-mode 1) 638 (electric-pair-mode 1)
639 (mark-sexp 1))) 639 (mark-sexp 1)))
640 640
641(define-electric-pair-test autowrapping-6 641(define-electric-pair-test autowrapping-6
642 "foo" "\"" :expected-string "\"foo\"" :expected-point 6 642 "foo" "\"" :expected-string "\"foo\"" :expected-point 6
643 :fixture-fn #'(lambda () 643 :fixture-fn (lambda ()
644 (electric-pair-mode 1) 644 (electric-pair-mode 1)
645 (goto-char (point-max)) 645 (goto-char (point-max))
646 (skip-chars-backward "\"") 646 (skip-chars-backward "\"")
647 (mark-sexp -1))) 647 (mark-sexp -1)))
648 648
649(define-electric-pair-test autowrapping-7 649(define-electric-pair-test autowrapping-7
650 "foo" "\"" :expected-string "``foo''" :expected-point 8 650 "foo" "\"" :expected-string "``foo''" :expected-point 8
651 :modes '(tex-mode) 651 :modes '(tex-mode)
652 :test-in-comments nil 652 :test-in-comments nil
653 :fixture-fn #'(lambda () 653 :fixture-fn (lambda ()
654 (electric-pair-mode 1) 654 (electric-pair-mode 1)
655 (goto-char (point-max)) 655 (goto-char (point-max))
656 (skip-chars-backward "\"") 656 (skip-chars-backward "\"")
657 (mark-sexp -1))) 657 (mark-sexp -1)))
658 658
659 659
660;;; Electric quotes 660;;; Electric quotes
diff --git a/test/lisp/epg-config-tests.el b/test/lisp/epg-config-tests.el
new file mode 100644
index 00000000000..fba61e573c3
--- /dev/null
+++ b/test/lisp/epg-config-tests.el
@@ -0,0 +1,47 @@
1;;; epg-config-tests.el --- Test suite for epg.el -*- lexical-binding: t -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'epg-config)
26
27(ert-deftest epg-config-test-epg-find-configuration ()
28 (skip-unless (executable-find "gpg2"))
29 (should (assq 'version (epg-find-configuration 'OpenPGP))))
30
31(ert-deftest epg-config-test-epg-find-configuration/unknown-protocol ()
32 (should-error (epg-find-configuration 'does-not-exist)))
33
34(ert-deftest epg-config-test-epg-check-configuration ()
35 (should (epg-check-configuration '((version . "1.0")) "0.9"))
36 (should (epg-check-configuration '((version . "1.0")) "1.0"))
37 (should-error (epg-check-configuration '((version . "1.0")) "1.1"))
38 (should-error (epg-check-configuration '((version . "1.0")) 'foo))
39 (should-error (epg-check-configuration '((version . "1.0")) "foo")))
40
41(ert-deftest epg-config-test-epg-required-version-p ()
42 (skip-unless (executable-find "gpg2"))
43 (should (epg-required-version-p 'OpenPGP "1.0")))
44
45(provide 'epg-config-tests)
46
47;;; epg-config-tests.el ends here
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 4a2f1f9a676..13350b24422 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -117,8 +117,9 @@ There are different timeouts for local and remote file notification libraries."
117(defun file-notify--test-timeout () 117(defun file-notify--test-timeout ()
118 "Timeout to wait for arriving a bunch of events, in seconds." 118 "Timeout to wait for arriving a bunch of events, in seconds."
119 (cond 119 (cond
120 ((file-remote-p temporary-file-directory) 20)
120 ((eq system-type 'cygwin) 10) 121 ((eq system-type 'cygwin) 10)
121 ((file-remote-p temporary-file-directory) 6) 122 ((getenv "EMACS_EMBA_CI") 10)
122 ((string-equal (file-notify--test-library) "w32notify") 4) 123 ((string-equal (file-notify--test-library) "w32notify") 4)
123 (t 3))) 124 (t 3)))
124 125
diff --git a/test/lisp/progmodes/executable-tests.el b/test/lisp/progmodes/executable-tests.el
new file mode 100644
index 00000000000..4f0fa699f72
--- /dev/null
+++ b/test/lisp/progmodes/executable-tests.el
@@ -0,0 +1,51 @@
1;;; executable-tests.el --- Tests for executable.el -*- lexical-binding:t -*-
2
3;; Copyright (C) 2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'executable)
26
27(ert-deftest executable-tests-set-magic ()
28 (with-temp-buffer
29 (insert "#!/foo/bar")
30 (executable-set-magic "/bin/bash" nil t t)
31 (should (equal (buffer-string) "#!/bin/bash"))))
32
33(ert-deftest executable-tests-set-magic/with-argument ()
34 (with-temp-buffer
35 (insert "#!/foo/bar")
36 (executable-set-magic "/bin/bash" "--norc" t t)
37 (should (equal (buffer-string) "#!/bin/bash --norc"))))
38
39(ert-deftest executable-tests-set-magic/executable-insert-nil ()
40 (let ((executable-insert nil))
41 (with-temp-buffer
42 (insert "#!/foo/bar")
43 (executable-set-magic "/bin/bash" nil t nil)
44 (should (equal (buffer-string) "#!/foo/bar"))))
45 (let ((executable-insert nil))
46 (with-temp-buffer
47 (insert "#!/foo/bar")
48 (executable-set-magic "/bin/bash" nil t t)
49 (should (equal (buffer-string) "#!/bin/bash")))))
50
51;;; executable-tests.el ends here
diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el
index 9982c32d41d..c25bbd94775 100644
--- a/test/lisp/progmodes/xref-tests.el
+++ b/test/lisp/progmodes/xref-tests.el
@@ -143,7 +143,7 @@
143 (let* ((data-parent-dir 143 (let* ((data-parent-dir
144 (file-name-directory (directory-file-name xref-tests--data-dir))) 144 (file-name-directory (directory-file-name xref-tests--data-dir)))
145 (project-find-functions 145 (project-find-functions
146 #'(lambda (_) (cons 'transient data-parent-dir))) 146 (lambda (_) (cons 'transient data-parent-dir)))
147 (xref-file-name-display 'project-relative) 147 (xref-file-name-display 'project-relative)
148 ;; Some older BSD find versions can produce '//' in the output. 148 ;; Some older BSD find versions can produce '//' in the output.
149 (expected (list 149 (expected (list
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index f14d2426ef0..0e1ca76fd9c 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -315,8 +315,8 @@
315 "Test signaling a thread as soon as it is started by the OS." 315 "Test signaling a thread as soon as it is started by the OS."
316 (skip-unless (featurep 'threads)) 316 (skip-unless (featurep 'threads))
317 (let ((thread 317 (let ((thread
318 (make-thread #'(lambda () 318 (make-thread (lambda ()
319 (while t (thread-yield)))))) 319 (while t (thread-yield))))))
320 (thread-signal thread 'error nil) 320 (thread-signal thread 'error nil)
321 (sit-for 1) 321 (sit-for 1)
322 (should-not (thread-live-p thread)) 322 (should-not (thread-live-p thread))
@@ -331,7 +331,7 @@
331 (let (buffer-read-only) 331 (let (buffer-read-only)
332 (erase-buffer)) 332 (erase-buffer))
333 (let ((thread 333 (let ((thread
334 (make-thread #'(lambda () (thread-signal main-thread 'error nil))))) 334 (make-thread (lambda () (thread-signal main-thread 'error nil)))))
335 (while (thread-live-p thread) 335 (while (thread-live-p thread)
336 (thread-yield)) 336 (thread-yield))
337 (read-event nil nil 0.1) 337 (read-event nil nil 0.1)