diff options
| author | Stefan Kangas | 2020-10-24 02:28:45 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-10-24 02:29:04 +0200 |
| commit | e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8 (patch) | |
| tree | 2a487b25181e43d8674701c2e3123dbdc7b61d7f | |
| parent | ab7dddea907ebb226fd657cc2fad441a374dfd7f (diff) | |
| download | emacs-e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8.tar.gz emacs-e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8.zip | |
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.el | 11 |
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 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'ert) | ||
| 27 | (require 'ert-x) | ||
| 26 | (require 'shr) | 28 | (require 'shr) |
| 27 | 29 | ||
| 28 | (defconst shr-tests--datadir | ||
| 29 | (expand-file-name "test/data/shr" source-directory)) | ||
| 30 | |||
| 31 | (defun shr-test (name) | 30 | (defun shr-test (name) |
| 32 | (with-temp-buffer | 31 | (with-temp-buffer |
| 33 | (insert-file-contents (format (concat shr-tests--datadir "/%s.html") name)) | 32 | (insert-file-contents (format (concat (ert-resource-directory) "/%s.html") name)) |
| 34 | (let ((dom (libxml-parse-html-region (point-min) (point-max))) | 33 | (let ((dom (libxml-parse-html-region (point-min) (point-max))) |
| 35 | (shr-width 80) | 34 | (shr-width 80) |
| 36 | (shr-use-fonts nil)) | 35 | (shr-use-fonts nil)) |
| @@ -39,7 +38,7 @@ | |||
| 39 | (cons (buffer-substring-no-properties (point-min) (point-max)) | 38 | (cons (buffer-substring-no-properties (point-min) (point-max)) |
| 40 | (with-temp-buffer | 39 | (with-temp-buffer |
| 41 | (insert-file-contents | 40 | (insert-file-contents |
| 42 | (format (concat shr-tests--datadir "/%s.txt") name)) | 41 | (format (concat (ert-resource-directory) "/%s.txt") name)) |
| 43 | (while (re-search-forward "%\\([0-9A-F][0-9A-F]\\)" nil t) | 42 | (while (re-search-forward "%\\([0-9A-F][0-9A-F]\\)" nil t) |
| 44 | (replace-match (string (string-to-number (match-string 1) 16)) | 43 | (replace-match (string (string-to-number (match-string 1) 16)) |
| 45 | t t)) | 44 | t t)) |
| @@ -47,7 +46,7 @@ | |||
| 47 | 46 | ||
| 48 | (ert-deftest rendering () | 47 | (ert-deftest rendering () |
| 49 | (skip-unless (fboundp 'libxml-parse-html-region)) | 48 | (skip-unless (fboundp 'libxml-parse-html-region)) |
| 50 | (dolist (file (directory-files shr-tests--datadir nil "\\.html\\'")) | 49 | (dolist (file (directory-files (ert-resource-directory) nil "\\.html\\'")) |
| 51 | (let* ((name (replace-regexp-in-string "\\.html\\'" "" file)) | 50 | (let* ((name (replace-regexp-in-string "\\.html\\'" "" file)) |
| 52 | (result (shr-test name))) | 51 | (result (shr-test name))) |
| 53 | (unless (equal (car result) (cdr result)) | 52 | (unless (equal (car result) (cdr result)) |