[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9a68740: Fix accessing regex-resources in out-of-tr
From: |
Michal Nazarewicz |
Subject: |
[Emacs-diffs] master 9a68740: Fix accessing regex-resources in out-of-tree test runs in regex-tests |
Date: |
Wed, 3 Aug 2016 12:45:08 +0000 (UTC) |
branch: master
commit 9a68740d9650d2825094296b737a73f158f664ab
Author: Michal Nazarewicz <address@hidden>
Commit: Michal Nazarewicz <address@hidden>
Fix accessing regex-resources in out-of-tree test runs in regex-tests
[82a487d: Fix reading of regex-resources in regex-tests] attempted to
fix regex-tests failing when run from the source tree (i.e. via make)
by hard-coding path to regex-resources directory relative to the test
directory.
This fixed runs from the tree but broke the test when run using other
methods.
Fix by trying ‘load-file-name’ or ‘buffer-file-name’, whichever is set.
* test/src/regex-tests.el (regex-tests--resources-dir): New variable
storing path to the regex-resources directory.
(regex-tests-generic-line): Use aforementioned variable.
---
test/src/regex-tests.el | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/test/src/regex-tests.el b/test/src/regex-tests.el
index 898548d..85addca 100644
--- a/test/src/regex-tests.el
+++ b/test/src/regex-tests.el
@@ -21,6 +21,11 @@
(require 'ert)
+(defvar regex-tests--resources-dir
+ (concat (concat (file-name-directory (or load-file-name buffer-file-name))
+ "/regex-resources/"))
+ "Path to regex-resources directory next to the \"regex-tests.el\" file.")
+
(ert-deftest regex-word-cc-fallback-test ()
"Test that ‘[[:cc:]]*x’ matches ‘x’ (bug#24020).
@@ -98,7 +103,7 @@ are known failures, and are skipped."
`(with-temp-buffer
(modify-syntax-entry ?_ "w;; ") ; tests expect _ to be a word
- (insert-file-contents ,(concat "src/regex-resources/" test-file))
+ (insert-file-contents (concat regex-tests--resources-dir ,test-file))
(let ((case-fold-search nil)
(line-number 1)
(whitelist-idx 0))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 9a68740: Fix accessing regex-resources in out-of-tree test runs in regex-tests,
Michal Nazarewicz <=