aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorMichal Nazarewicz2016-07-27 17:25:34 +0200
committerMichal Nazarewicz2016-08-02 15:39:10 +0200
commit82a487d522106c1c5afb00f2fa6c9055e37ba5ad (patch)
treeef5cfd239c5ea5ac78133ee4912ee3e6538a2219 /test/src
parent91d53091950d7aae6f16cf47d4cce754b5eacfe5 (diff)
downloademacs-82a487d522106c1c5afb00f2fa6c9055e37ba5ad.tar.gz
emacs-82a487d522106c1c5afb00f2fa6c9055e37ba5ad.zip
Fix reading of regex-resources in regex-tests
* test/src/regex-tests.el (regex-tests-generic-line): Referring to ‘buffer-file-name’ does not work when running the test from command line, i.e. via make, which results in (wrong-type-argument stringp nil) failures. Replace it with hard-coded path. (regex-tests-BOOST, regex-tests-PCRE, regex-tests-PTESTS-whitelist, regex-tests-TESTS-whitelist): ‘regex-tests-generic-line’ now includes the ‘regex-resources’ path component so the tests don’t need to specify it explicitly.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/regex-tests.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/src/regex-tests.el b/test/src/regex-tests.el
index 13a9f86e00f..1407441965a 100644
--- a/test/src/regex-tests.el
+++ b/test/src/regex-tests.el
@@ -99,8 +99,7 @@ are known failures, and are skipped."
99 99
100 `(with-temp-buffer 100 `(with-temp-buffer
101 (modify-syntax-entry ?_ "w;; ") ; tests expect _ to be a word 101 (modify-syntax-entry ?_ "w;; ") ; tests expect _ to be a word
102 (insert-file-contents ,(concat (file-name-directory (buffer-file-name)) test-file)) 102 (insert-file-contents ,(concat "src/regex-resources/" test-file))
103
104 (let ((case-fold-search nil) 103 (let ((case-fold-search nil)
105 (line-number 1) 104 (line-number 1)
106 (whitelist-idx 0)) 105 (whitelist-idx 0))
@@ -419,7 +418,7 @@ differences in behavior.")
419 (let (failures 418 (let (failures
420 basic icase newline notbol noteol) 419 basic icase newline notbol noteol)
421 (regex-tests-generic-line 420 (regex-tests-generic-line
422 ?; "regex-resources/BOOST.tests" regex-tests-BOOST-whitelist 421 ?; "BOOST.tests" regex-tests-BOOST-whitelist
423 (if (save-excursion (re-search-forward "^-" nil t)) 422 (if (save-excursion (re-search-forward "^-" nil t))
424 (setq basic (save-excursion (re-search-forward "REG_BASIC" nil t)) 423 (setq basic (save-excursion (re-search-forward "REG_BASIC" nil t))
425 icase (save-excursion (re-search-forward "REG_ICASE" nil t)) 424 icase (save-excursion (re-search-forward "REG_ICASE" nil t))
@@ -496,7 +495,7 @@ differences in behavior.")
496 (let (failures 495 (let (failures
497 pattern icase string what-failed matches-observed) 496 pattern icase string what-failed matches-observed)
498 (regex-tests-generic-line 497 (regex-tests-generic-line
499 ?# "regex-resources/PCRE.tests" regex-tests-PCRE-whitelist 498 ?# "PCRE.tests" regex-tests-PCRE-whitelist
500 499
501 (cond 500 (cond
502 501
@@ -570,7 +569,7 @@ differences in behavior.")
570(defun regex-tests-PTESTS () 569(defun regex-tests-PTESTS ()
571 (let (failures) 570 (let (failures)
572 (regex-tests-generic-line 571 (regex-tests-generic-line
573 ?# "regex-resources/PTESTS" regex-tests-PTESTS-whitelist 572 ?# "PTESTS" regex-tests-PTESTS-whitelist
574 (let* ((fields (split-string (buffer-string) "¦")) 573 (let* ((fields (split-string (buffer-string) "¦"))
575 574
576 ;; string has 1-based index of first char in the 575 ;; string has 1-based index of first char in the
@@ -632,7 +631,7 @@ differences in behavior.")
632(defun regex-tests-TESTS () 631(defun regex-tests-TESTS ()
633 (let (failures) 632 (let (failures)
634 (regex-tests-generic-line 633 (regex-tests-generic-line
635 ?# "regex-resources/TESTS" regex-tests-TESTS-whitelist 634 ?# "TESTS" regex-tests-TESTS-whitelist
636 (if (save-excursion (re-search-forward "^\\([^:]+\\):\\(.*\\):\\([^:]*\\)$" nil t)) 635 (if (save-excursion (re-search-forward "^\\([^:]+\\):\\(.*\\):\\([^:]*\\)$" nil t))
637 (let* ((what-failed 636 (let* ((what-failed
638 (let ((raw (string-to-number (match-string 1)))) 637 (let ((raw (string-to-number (match-string 1))))