diff options
| author | Stefan Kangas | 2020-10-23 16:29:46 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-10-23 16:29:46 +0200 |
| commit | 49bc8586b7abc8e1e36027ca5eec0d0488a27474 (patch) | |
| tree | dd3d9c8a4eb7e85205ee7565d01c91ca21ef79ec | |
| parent | d21cdb6c056453d4e4ef8a3a1f27d8bc203c09ea (diff) | |
| download | emacs-49bc8586b7abc8e1e36027ca5eec0d0488a27474.tar.gz emacs-49bc8586b7abc8e1e36027ca5eec0d0488a27474.zip | |
Move some test data to follow our conventions
* test/data/emacs-module/mod-test.c: Move from here...
* test/src/emacs-module-resources/mod-test.c: ...to here.
* test/src/emacs-module-tests.el (ert-x): Require.
(mod-test-file, module/describe-function-1):
* test/Makefile.in (test_module_dir): Adjust for move.
* test/data/files-bug18141.el.gz: Move from here...
* test/lisp/files-resources/files-bug18141.el.gz: ... to here.
* test/lisp/files-tests.el (ert-x): Require.
(files-test-bug-18141-file): Use ert-resource-file.
* test/data/mailcap/mime.types: Move from here...
* test/lisp/net/mailcap-resources/mime.types: ...to here.
* test/lisp/net/mailcap-tests.el (ert-x): Require.
(mailcap-tests-path): Use ert-resource-file.
* test/data/somelib.el:
* test/data/somelib2.el: Move from here...
* test/src/lread-resources/somelib.el:
* test/src/lread-resources/somelib2.el: ...to here.
* test/src/lread-tests.el (ert, ert-x): Require.
(lread-test-bug26837): Use ert-resource-directory.
* test/data/syntax-comments.txt: Move from here....
* test/src/syntax-resources/syntax-comments.txt: ...to here.
* test/src/syntax-tests.el (ert-x): Require.
(syntax-comments, syntax-br-comments, syntax-pps-comments):
Use ert-resource-file.
* test/data/xref/file1.txt:
* test/data/xref/file2.txt: Move from here...
* test/lisp/progmodes/xref-resources/file1.txt:
* test/lisp/progmodes/xref-resources/file2.txt: ...to here.
* test/lisp/progmodes/xref-tests.el (ert, ert-x): Require.
(xref-tests-data-dir): Use ert-resource-directory.
| -rw-r--r-- | test/Makefile.in | 2 | ||||
| -rw-r--r-- | test/lisp/files-resources/files-bug18141.el.gz (renamed from test/data/files-bug18141.el.gz) | bin | 77 -> 77 bytes | |||
| -rw-r--r-- | test/lisp/files-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/net/mailcap-resources/mime.types (renamed from test/data/mailcap/mime.types) | 0 | ||||
| -rw-r--r-- | test/lisp/net/mailcap-tests.el | 7 | ||||
| -rw-r--r-- | test/lisp/progmodes/xref-resources/file1.txt (renamed from test/data/xref/file1.txt) | 0 | ||||
| -rw-r--r-- | test/lisp/progmodes/xref-resources/file2.txt (renamed from test/data/xref/file2.txt) | 0 | ||||
| -rw-r--r-- | test/lisp/progmodes/xref-tests.el | 7 | ||||
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c (renamed from test/data/emacs-module/mod-test.c) | 0 | ||||
| -rw-r--r-- | test/src/emacs-module-tests.el | 12 | ||||
| -rw-r--r-- | test/src/lread-resources/somelib.el (renamed from test/data/somelib.el) | 0 | ||||
| -rw-r--r-- | test/src/lread-resources/somelib2.el (renamed from test/data/somelib2.el) | 0 | ||||
| -rw-r--r-- | test/src/lread-tests.el | 8 | ||||
| -rw-r--r-- | test/src/syntax-resources/syntax-comments.txt (renamed from test/data/syntax-comments.txt) | 0 | ||||
| -rw-r--r-- | test/src/syntax-tests.el | 12 |
15 files changed, 23 insertions, 28 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 9974eb54b03..67d203df297 100644 --- a/test/Makefile.in +++ b/test/Makefile.in | |||
| @@ -132,7 +132,7 @@ emacs = EMACSLOADPATH= \ | |||
| 132 | # exists, or writing to ~/.bzr.log when running bzr commands). | 132 | # exists, or writing to ~/.bzr.log when running bzr commands). |
| 133 | TEST_HOME = /nonexistent | 133 | TEST_HOME = /nonexistent |
| 134 | 134 | ||
| 135 | test_module_dir := data/emacs-module | 135 | test_module_dir := src/emacs-module-resources |
| 136 | 136 | ||
| 137 | .PHONY: all check | 137 | .PHONY: all check |
| 138 | 138 | ||
diff --git a/test/data/files-bug18141.el.gz b/test/lisp/files-resources/files-bug18141.el.gz index 53d463e85b5..53d463e85b5 100644 --- a/test/data/files-bug18141.el.gz +++ b/test/lisp/files-resources/files-bug18141.el.gz | |||
| Binary files differ | |||
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 1b964af6887..8818099a223 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ert-x) | ||
| 23 | (require 'nadvice) | 24 | (require 'nadvice) |
| 24 | (eval-when-compile (require 'cl-lib)) | 25 | (eval-when-compile (require 'cl-lib)) |
| 25 | (require 'bytecomp) ; `byte-compiler-base-file-name'. | 26 | (require 'bytecomp) ; `byte-compiler-base-file-name'. |
| @@ -151,7 +152,7 @@ form.") | |||
| 151 | (should (file-test--do-local-variables-test str subtest))))))) | 152 | (should (file-test--do-local-variables-test str subtest))))))) |
| 152 | 153 | ||
| 153 | (defvar files-test-bug-18141-file | 154 | (defvar files-test-bug-18141-file |
| 154 | (expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY")) | 155 | (ert-resource-file "files-bug18141.el.gz") |
| 155 | "Test file for bug#18141.") | 156 | "Test file for bug#18141.") |
| 156 | 157 | ||
| 157 | (ert-deftest files-tests-bug-18141 () | 158 | (ert-deftest files-tests-bug-18141 () |
diff --git a/test/data/mailcap/mime.types b/test/lisp/net/mailcap-resources/mime.types index 4bedfaf9702..4bedfaf9702 100644 --- a/test/data/mailcap/mime.types +++ b/test/lisp/net/mailcap-resources/mime.types | |||
diff --git a/test/lisp/net/mailcap-tests.el b/test/lisp/net/mailcap-tests.el index 8354d8e5e23..0ebbec61159 100644 --- a/test/lisp/net/mailcap-tests.el +++ b/test/lisp/net/mailcap-tests.el | |||
| @@ -24,13 +24,10 @@ | |||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'ert) | 26 | (require 'ert) |
| 27 | (require 'ert-x) | ||
| 27 | (require 'mailcap) | 28 | (require 'mailcap) |
| 28 | 29 | ||
| 29 | (defconst mailcap-tests-data-dir | 30 | (defconst mailcap-tests-path (ert-resource-file "mime.types") |
| 30 | (expand-file-name "test/data/mailcap" source-directory)) | ||
| 31 | |||
| 32 | (defconst mailcap-tests-path | ||
| 33 | (expand-file-name "mime.types" mailcap-tests-data-dir) | ||
| 34 | "String used as PATH argument of `mailcap-parse-mimetypes'.") | 31 | "String used as PATH argument of `mailcap-parse-mimetypes'.") |
| 35 | 32 | ||
| 36 | (defconst mailcap-tests-mime-extensions (copy-alist mailcap-mime-extensions)) | 33 | (defconst mailcap-tests-mime-extensions (copy-alist mailcap-mime-extensions)) |
diff --git a/test/data/xref/file1.txt b/test/lisp/progmodes/xref-resources/file1.txt index 5d7cc544443..5d7cc544443 100644 --- a/test/data/xref/file1.txt +++ b/test/lisp/progmodes/xref-resources/file1.txt | |||
diff --git a/test/data/xref/file2.txt b/test/lisp/progmodes/xref-resources/file2.txt index 9f075f26004..9f075f26004 100644 --- a/test/data/xref/file2.txt +++ b/test/lisp/progmodes/xref-resources/file2.txt | |||
diff --git a/test/lisp/progmodes/xref-tests.el b/test/lisp/progmodes/xref-tests.el index a4980b2acb1..060c9cb5d1c 100644 --- a/test/lisp/progmodes/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el | |||
| @@ -23,13 +23,12 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'ert) | ||
| 27 | (require 'ert-x) | ||
| 26 | (require 'xref) | 28 | (require 'xref) |
| 27 | (require 'cl-lib) | 29 | (require 'cl-lib) |
| 28 | 30 | ||
| 29 | (defvar xref-tests-data-dir | 31 | (defvar xref-tests-data-dir (ert-resource-directory)) |
| 30 | (expand-file-name "../../../data/xref/" | ||
| 31 | (or load-file-name | ||
| 32 | buffer-file-name))) | ||
| 33 | 32 | ||
| 34 | (ert-deftest xref-matches-in-directory-finds-none-for-some-regexp () | 33 | (ert-deftest xref-matches-in-directory-finds-none-for-some-regexp () |
| 35 | (should (null (xref-matches-in-directory "zzz" "*" xref-tests-data-dir nil)))) | 34 | (should (null (xref-matches-in-directory "zzz" "*" xref-tests-data-dir nil)))) |
diff --git a/test/data/emacs-module/mod-test.c b/test/src/emacs-module-resources/mod-test.c index 258a679b207..258a679b207 100644 --- a/test/data/emacs-module/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c | |||
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 621229c62aa..fb4ed4a6842 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el | |||
| @@ -21,13 +21,14 @@ | |||
| 21 | 21 | ||
| 22 | ;; Unit tests for the dynamic module facility. See Info node `(elisp) | 22 | ;; Unit tests for the dynamic module facility. See Info node `(elisp) |
| 23 | ;; Writing Dynamic Modules'. These tests make use of a small test | 23 | ;; Writing Dynamic Modules'. These tests make use of a small test |
| 24 | ;; module in test/data/emacs-module. | 24 | ;; module in the "emacs-module-resources" directory. |
| 25 | 25 | ||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | ;;; Prelude | 27 | ;;; Prelude |
| 28 | 28 | ||
| 29 | (require 'cl-lib) | 29 | (require 'cl-lib) |
| 30 | (require 'ert) | 30 | (require 'ert) |
| 31 | (require 'ert-x) | ||
| 31 | (require 'help-fns) | 32 | (require 'help-fns) |
| 32 | 33 | ||
| 33 | (defconst mod-test-emacs | 34 | (defconst mod-test-emacs |
| @@ -35,8 +36,7 @@ | |||
| 35 | "File name of the Emacs binary currently running.") | 36 | "File name of the Emacs binary currently running.") |
| 36 | 37 | ||
| 37 | (eval-and-compile | 38 | (eval-and-compile |
| 38 | (defconst mod-test-file | 39 | (defconst mod-test-file (ert-resource-file "mod-test") |
| 39 | (expand-file-name "../test/data/emacs-module/mod-test" invocation-directory) | ||
| 40 | "File name of the module test file.")) | 40 | "File name of the module test file.")) |
| 41 | 41 | ||
| 42 | (require 'mod-test mod-test-file) | 42 | (require 'mod-test mod-test-file) |
| @@ -313,11 +313,11 @@ local reference." | |||
| 313 | (text-quoting-style 'grave)) | 313 | (text-quoting-style 'grave)) |
| 314 | (describe-function-1 #'mod-test-sum) | 314 | (describe-function-1 #'mod-test-sum) |
| 315 | (goto-char (point-min)) | 315 | (goto-char (point-min)) |
| 316 | (while (re-search-forward "`[^']*/data/emacs-module/" nil t) | 316 | (while (re-search-forward "`[^']*/src/emacs-module-resources/" nil t) |
| 317 | (replace-match "`data/emacs-module/")) | 317 | (replace-match "`src/emacs-module-resources/")) |
| 318 | (should (equal | 318 | (should (equal |
| 319 | (buffer-substring-no-properties 1 (point-max)) | 319 | (buffer-substring-no-properties 1 (point-max)) |
| 320 | (format "a module function in `data/emacs-module/mod-test%s'. | 320 | (format "a module function in `src/emacs-module-resources/mod-test%s'. |
| 321 | 321 | ||
| 322 | (mod-test-sum a b) | 322 | (mod-test-sum a b) |
| 323 | 323 | ||
diff --git a/test/data/somelib.el b/test/src/lread-resources/somelib.el index 7b8d4037396..7b8d4037396 100644 --- a/test/data/somelib.el +++ b/test/src/lread-resources/somelib.el | |||
diff --git a/test/data/somelib2.el b/test/src/lread-resources/somelib2.el index 05156145a22..05156145a22 100644 --- a/test/data/somelib2.el +++ b/test/src/lread-resources/somelib2.el | |||
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 26fd6aa22a1..825b74e6234 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -25,6 +25,9 @@ | |||
| 25 | 25 | ||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (require 'ert) | ||
| 29 | (require 'ert-x) | ||
| 30 | |||
| 28 | (ert-deftest lread-char-number () | 31 | (ert-deftest lread-char-number () |
| 29 | (should (equal (read "?\\N{U+A817}") #xA817))) | 32 | (should (equal (read "?\\N{U+A817}") #xA817))) |
| 30 | 33 | ||
| @@ -146,10 +149,7 @@ literals (Bug#20852)." | |||
| 146 | 149 | ||
| 147 | (ert-deftest lread-test-bug26837 () | 150 | (ert-deftest lread-test-bug26837 () |
| 148 | "Test for https://debbugs.gnu.org/26837 ." | 151 | "Test for https://debbugs.gnu.org/26837 ." |
| 149 | (let ((load-path (cons | 152 | (let ((load-path (cons (ert-resource-directory) load-path))) |
| 150 | (file-name-as-directory | ||
| 151 | (expand-file-name "data" (getenv "EMACS_TEST_DIRECTORY"))) | ||
| 152 | load-path))) | ||
| 153 | (load "somelib" nil t) | 153 | (load "somelib" nil t) |
| 154 | (should (string-suffix-p "/somelib.el" (caar load-history))) | 154 | (should (string-suffix-p "/somelib.el" (caar load-history))) |
| 155 | (load "somelib2" nil t) | 155 | (load "somelib2" nil t) |
diff --git a/test/data/syntax-comments.txt b/test/src/syntax-resources/syntax-comments.txt index 6f595e4d8dc..6f595e4d8dc 100644 --- a/test/data/syntax-comments.txt +++ b/test/src/syntax-resources/syntax-comments.txt | |||
diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el index 56e03380579..4b9c3f277aa 100644 --- a/test/src/syntax-tests.el +++ b/test/src/syntax-tests.el | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | ;;; Code: | 20 | ;;; Code: |
| 21 | 21 | ||
| 22 | (require 'ert) | 22 | (require 'ert) |
| 23 | (require 'ert-x) | ||
| 23 | 24 | ||
| 24 | (ert-deftest parse-partial-sexp-continue-over-comment-marker () | 25 | (ert-deftest parse-partial-sexp-continue-over-comment-marker () |
| 25 | "Continue a parse that stopped in the middle of a comment marker." | 26 | "Continue a parse that stopped in the middle of a comment marker." |
| @@ -91,7 +92,7 @@ also has open paren syntax (see Bug#24870)." | |||
| 91 | ;; It is intended to enhance this bit to test nested comments | 92 | ;; It is intended to enhance this bit to test nested comments |
| 92 | ;; (2020-10-01). | 93 | ;; (2020-10-01). |
| 93 | 94 | ||
| 94 | ;; This bit uses the data file test/data/syntax-comments.txt. | 95 | ;; This bit uses the data file syntax-resources/syntax-comments.txt. |
| 95 | 96 | ||
| 96 | (defun syntax-comments-point (n forw) | 97 | (defun syntax-comments-point (n forw) |
| 97 | "Return the buffer offset corresponding to the \"label\" N. | 98 | "Return the buffer offset corresponding to the \"label\" N. |
| @@ -182,8 +183,7 @@ missing or nil, the value of START is assumed for it." | |||
| 182 | () | 183 | () |
| 183 | (with-current-buffer | 184 | (with-current-buffer |
| 184 | (find-file | 185 | (find-file |
| 185 | ,(expand-file-name "data/syntax-comments.txt" | 186 | ,(ert-resource-file "syntax-comments.txt")) |
| 186 | (getenv "EMACS_TEST_DIRECTORY"))) | ||
| 187 | (,(intern (concat (symbol-name type) "-in"))) | 187 | (,(intern (concat (symbol-name type) "-in"))) |
| 188 | (goto-char (syntax-comments-point ,start ,forw)) | 188 | (goto-char (syntax-comments-point ,start ,forw)) |
| 189 | (let ((stop (syntax-comments-point ,(or stop start) ,(not forw)))) | 189 | (let ((stop (syntax-comments-point ,(or stop start) ,(not forw)))) |
| @@ -230,8 +230,7 @@ missing or nil, the value of -START- is assumed for it." | |||
| 230 | () | 230 | () |
| 231 | (with-current-buffer | 231 | (with-current-buffer |
| 232 | (find-file | 232 | (find-file |
| 233 | ,(expand-file-name "data/syntax-comments.txt" | 233 | ,(ert-resource-file "syntax-comments.txt")) |
| 234 | (getenv "EMACS_TEST_DIRECTORY"))) | ||
| 235 | (,(intern (concat (symbol-name type) "-in"))) | 234 | (,(intern (concat (symbol-name type) "-in"))) |
| 236 | (let ((start-pos (syntax-comments-point ,start ,forw)) | 235 | (let ((start-pos (syntax-comments-point ,start ,forw)) |
| 237 | ,@(if res | 236 | ,@(if res |
| @@ -285,8 +284,7 @@ the `parse-partial-sexp's are expected to stop. See | |||
| 285 | () | 284 | () |
| 286 | (with-current-buffer | 285 | (with-current-buffer |
| 287 | (find-file | 286 | (find-file |
| 288 | ,(expand-file-name "data/syntax-comments.txt" | 287 | ,(ert-resource-file "syntax-comments.txt")) |
| 289 | (getenv "EMACS_TEST_DIRECTORY"))) | ||
| 290 | (,(intern (concat (symbol-name type) "-in"))) | 288 | (,(intern (concat (symbol-name type) "-in"))) |
| 291 | (let ((start-pos (syntax-comments-point ,start t)) | 289 | (let ((start-pos (syntax-comments-point ,start t)) |
| 292 | (open-pos (syntax-comments-midpoint ,open)) | 290 | (open-pos (syntax-comments-midpoint ,open)) |