summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2020-10-24 02:28:45 +0200
committerStefan Kangas <stefan@marxist.se>2020-10-24 02:29:04 +0200
commite402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8 (patch)
tree2a487b25181e43d8674701c2e3123dbdc7b61d7f
parentab7dddea907ebb226fd657cc2fad441a374dfd7f (diff)
downloademacs-e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8.tar.gz
Move shr.el test data to follow our conventions
* test/lisp/net/shr-tests.el (ert, ert-x): Require. (shr-tests--datadir): Remove variable. (shr-test, rendering): Use ert-resource-directory. * test/lisp/net/shr-resources/*: Move from test/data/shr/.
-rw-r--r--test/lisp/net/shr-resources/div-div.html (renamed from test/data/shr/div-div.html)0
-rw-r--r--test/lisp/net/shr-resources/div-div.txt (renamed from test/data/shr/div-div.txt)0
-rw-r--r--test/lisp/net/shr-resources/div-p.html (renamed from test/data/shr/div-p.html)0
-rw-r--r--test/lisp/net/shr-resources/div-p.txt (renamed from test/data/shr/div-p.txt)0
-rw-r--r--test/lisp/net/shr-resources/li-div.html (renamed from test/data/shr/li-div.html)0
-rw-r--r--test/lisp/net/shr-resources/li-div.txt (renamed from test/data/shr/li-div.txt)0
-rw-r--r--test/lisp/net/shr-resources/li-empty.html (renamed from test/data/shr/li-empty.html)0
-rw-r--r--test/lisp/net/shr-resources/li-empty.txt (renamed from test/data/shr/li-empty.txt)0
-rw-r--r--test/lisp/net/shr-resources/nonbr.html (renamed from test/data/shr/nonbr.html)0
-rw-r--r--test/lisp/net/shr-resources/nonbr.txt (renamed from test/data/shr/nonbr.txt)0
-rw-r--r--test/lisp/net/shr-resources/ol.html (renamed from test/data/shr/ol.html)0
-rw-r--r--test/lisp/net/shr-resources/ol.txt (renamed from test/data/shr/ol.txt)0
-rw-r--r--test/lisp/net/shr-resources/ul-empty.html (renamed from test/data/shr/ul-empty.html)0
-rw-r--r--test/lisp/net/shr-resources/ul-empty.txt (renamed from test/data/shr/ul-empty.txt)0
-rw-r--r--test/lisp/net/shr-tests.el11
15 files changed, 5 insertions, 6 deletions
diff --git a/test/data/shr/div-div.html b/test/lisp/net/shr-resources/div-div.html
index 1c191ae44d8..1c191ae44d8 100644
--- a/test/data/shr/div-div.html
+++ b/test/lisp/net/shr-resources/div-div.html
diff --git a/test/data/shr/div-div.txt b/test/lisp/net/shr-resources/div-div.txt
index 62715e12513..62715e12513 100644
--- a/test/data/shr/div-div.txt
+++ b/test/lisp/net/shr-resources/div-div.txt
diff --git a/test/data/shr/div-p.html b/test/lisp/net/shr-resources/div-p.html
index fcbdfc43293..fcbdfc43293 100644
--- a/test/data/shr/div-p.html
+++ b/test/lisp/net/shr-resources/div-p.html
diff --git a/test/data/shr/div-p.txt b/test/lisp/net/shr-resources/div-p.txt
index 859d731da89..859d731da89 100644
--- a/test/data/shr/div-p.txt
+++ b/test/lisp/net/shr-resources/div-p.txt
diff --git a/test/data/shr/li-div.html b/test/lisp/net/shr-resources/li-div.html
index eca3c511bd9..eca3c511bd9 100644
--- a/test/data/shr/li-div.html
+++ b/test/lisp/net/shr-resources/li-div.html
diff --git a/test/data/shr/li-div.txt b/test/lisp/net/shr-resources/li-div.txt
index 9fc54f2bdc6..9fc54f2bdc6 100644
--- a/test/data/shr/li-div.txt
+++ b/test/lisp/net/shr-resources/li-div.txt
diff --git a/test/data/shr/li-empty.html b/test/lisp/net/shr-resources/li-empty.html
index 05cfee7bdd4..05cfee7bdd4 100644
--- a/test/data/shr/li-empty.html
+++ b/test/lisp/net/shr-resources/li-empty.html
diff --git a/test/data/shr/li-empty.txt b/test/lisp/net/shr-resources/li-empty.txt
index 906fd8df8b3..906fd8df8b3 100644
--- a/test/data/shr/li-empty.txt
+++ b/test/lisp/net/shr-resources/li-empty.txt
diff --git a/test/data/shr/nonbr.html b/test/lisp/net/shr-resources/nonbr.html
index 56282cf4ca5..56282cf4ca5 100644
--- a/test/data/shr/nonbr.html
+++ b/test/lisp/net/shr-resources/nonbr.html
diff --git a/test/data/shr/nonbr.txt b/test/lisp/net/shr-resources/nonbr.txt
index 0c3cffa93f9..0c3cffa93f9 100644
--- a/test/data/shr/nonbr.txt
+++ b/test/lisp/net/shr-resources/nonbr.txt
diff --git a/test/data/shr/ol.html b/test/lisp/net/shr-resources/ol.html
index f9a15f26409..f9a15f26409 100644
--- a/test/data/shr/ol.html
+++ b/test/lisp/net/shr-resources/ol.html
diff --git a/test/data/shr/ol.txt b/test/lisp/net/shr-resources/ol.txt
index 0d46e2a8ddb..0d46e2a8ddb 100644
--- a/test/data/shr/ol.txt
+++ b/test/lisp/net/shr-resources/ol.txt
diff --git a/test/data/shr/ul-empty.html b/test/lisp/net/shr-resources/ul-empty.html
index e5a75ab9216..e5a75ab9216 100644
--- a/test/data/shr/ul-empty.html
+++ b/test/lisp/net/shr-resources/ul-empty.html
diff --git a/test/data/shr/ul-empty.txt b/test/lisp/net/shr-resources/ul-empty.txt
index 8993555425b..8993555425b 100644
--- a/test/data/shr/ul-empty.txt
+++ b/test/lisp/net/shr-resources/ul-empty.txt
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index 88a31bcf645..abc4f6a656b 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -23,14 +23,13 @@
;;; Code:
+(require 'ert)
+(require 'ert-x)
(require 'shr)
-(defconst shr-tests--datadir
- (expand-file-name "test/data/shr" source-directory))
-
(defun shr-test (name)
(with-temp-buffer
- (insert-file-contents (format (concat shr-tests--datadir "/%s.html") name))
+ (insert-file-contents (format (concat (ert-resource-directory) "/%s.html") name))
(let ((dom (libxml-parse-html-region (point-min) (point-max)))
(shr-width 80)
(shr-use-fonts nil))
@@ -39,7 +38,7 @@
(cons (buffer-substring-no-properties (point-min) (point-max))
(with-temp-buffer
(insert-file-contents
- (format (concat shr-tests--datadir "/%s.txt") name))
+ (format (concat (ert-resource-directory) "/%s.txt") name))
(while (re-search-forward "%\\([0-9A-F][0-9A-F]\\)" nil t)
(replace-match (string (string-to-number (match-string 1) 16))
t t))
@@ -47,7 +46,7 @@
(ert-deftest rendering ()
(skip-unless (fboundp 'libxml-parse-html-region))
- (dolist (file (directory-files shr-tests--datadir nil "\\.html\\'"))
+ (dolist (file (directory-files (ert-resource-directory) nil "\\.html\\'"))
(let* ((name (replace-regexp-in-string "\\.html\\'" "" file))
(result (shr-test name)))
(unless (equal (car result) (cdr result))