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.
This commit is contained in:
Stefan Kangas 2020-10-23 16:29:46 +02:00
parent d21cdb6c05
commit 49bc8586b7
15 changed files with 23 additions and 28 deletions

View file

@ -132,7 +132,7 @@ emacs = EMACSLOADPATH= \
# exists, or writing to ~/.bzr.log when running bzr commands).
TEST_HOME = /nonexistent
test_module_dir := data/emacs-module
test_module_dir := src/emacs-module-resources
.PHONY: all check

View file

@ -20,6 +20,7 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'nadvice)
(eval-when-compile (require 'cl-lib))
(require 'bytecomp) ; `byte-compiler-base-file-name'.
@ -151,7 +152,7 @@ form.")
(should (file-test--do-local-variables-test str subtest)))))))
(defvar files-test-bug-18141-file
(expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY"))
(ert-resource-file "files-bug18141.el.gz")
"Test file for bug#18141.")
(ert-deftest files-tests-bug-18141 ()

View file

@ -24,13 +24,10 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'mailcap)
(defconst mailcap-tests-data-dir
(expand-file-name "test/data/mailcap" source-directory))
(defconst mailcap-tests-path
(expand-file-name "mime.types" mailcap-tests-data-dir)
(defconst mailcap-tests-path (ert-resource-file "mime.types")
"String used as PATH argument of `mailcap-parse-mimetypes'.")
(defconst mailcap-tests-mime-extensions (copy-alist mailcap-mime-extensions))

View file

@ -23,13 +23,12 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(require 'xref)
(require 'cl-lib)
(defvar xref-tests-data-dir
(expand-file-name "../../../data/xref/"
(or load-file-name
buffer-file-name)))
(defvar xref-tests-data-dir (ert-resource-directory))
(ert-deftest xref-matches-in-directory-finds-none-for-some-regexp ()
(should (null (xref-matches-in-directory "zzz" "*" xref-tests-data-dir nil))))

View file

@ -21,13 +21,14 @@
;; Unit tests for the dynamic module facility. See Info node `(elisp)
;; Writing Dynamic Modules'. These tests make use of a small test
;; module in test/data/emacs-module.
;; module in the "emacs-module-resources" directory.
;;; Code:
;;; Prelude
(require 'cl-lib)
(require 'ert)
(require 'ert-x)
(require 'help-fns)
(defconst mod-test-emacs
@ -35,8 +36,7 @@
"File name of the Emacs binary currently running.")
(eval-and-compile
(defconst mod-test-file
(expand-file-name "../test/data/emacs-module/mod-test" invocation-directory)
(defconst mod-test-file (ert-resource-file "mod-test")
"File name of the module test file."))
(require 'mod-test mod-test-file)
@ -313,11 +313,11 @@ local reference."
(text-quoting-style 'grave))
(describe-function-1 #'mod-test-sum)
(goto-char (point-min))
(while (re-search-forward "`[^']*/data/emacs-module/" nil t)
(replace-match "`data/emacs-module/"))
(while (re-search-forward "`[^']*/src/emacs-module-resources/" nil t)
(replace-match "`src/emacs-module-resources/"))
(should (equal
(buffer-substring-no-properties 1 (point-max))
(format "a module function in `data/emacs-module/mod-test%s'.
(format "a module function in `src/emacs-module-resources/mod-test%s'.
(mod-test-sum a b)

View file

@ -25,6 +25,9 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(ert-deftest lread-char-number ()
(should (equal (read "?\\N{U+A817}") #xA817)))
@ -146,10 +149,7 @@ literals (Bug#20852)."
(ert-deftest lread-test-bug26837 ()
"Test for https://debbugs.gnu.org/26837 ."
(let ((load-path (cons
(file-name-as-directory
(expand-file-name "data" (getenv "EMACS_TEST_DIRECTORY")))
load-path)))
(let ((load-path (cons (ert-resource-directory) load-path)))
(load "somelib" nil t)
(should (string-suffix-p "/somelib.el" (caar load-history)))
(load "somelib2" nil t)

View file

@ -20,6 +20,7 @@
;;; Code:
(require 'ert)
(require 'ert-x)
(ert-deftest parse-partial-sexp-continue-over-comment-marker ()
"Continue a parse that stopped in the middle of a comment marker."
@ -91,7 +92,7 @@ also has open paren syntax (see Bug#24870)."
;; It is intended to enhance this bit to test nested comments
;; (2020-10-01).
;; This bit uses the data file test/data/syntax-comments.txt.
;; This bit uses the data file syntax-resources/syntax-comments.txt.
(defun syntax-comments-point (n forw)
"Return the buffer offset corresponding to the \"label\" N.
@ -182,8 +183,7 @@ missing or nil, the value of START is assumed for it."
()
(with-current-buffer
(find-file
,(expand-file-name "data/syntax-comments.txt"
(getenv "EMACS_TEST_DIRECTORY")))
,(ert-resource-file "syntax-comments.txt"))
(,(intern (concat (symbol-name type) "-in")))
(goto-char (syntax-comments-point ,start ,forw))
(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."
()
(with-current-buffer
(find-file
,(expand-file-name "data/syntax-comments.txt"
(getenv "EMACS_TEST_DIRECTORY")))
,(ert-resource-file "syntax-comments.txt"))
(,(intern (concat (symbol-name type) "-in")))
(let ((start-pos (syntax-comments-point ,start ,forw))
,@(if res
@ -285,8 +284,7 @@ the `parse-partial-sexp's are expected to stop. See
()
(with-current-buffer
(find-file
,(expand-file-name "data/syntax-comments.txt"
(getenv "EMACS_TEST_DIRECTORY")))
,(ert-resource-file "syntax-comments.txt"))
(,(intern (concat (symbol-name type) "-in")))
(let ((start-pos (syntax-comments-point ,start t))
(open-pos (syntax-comments-midpoint ,open))