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/.
This commit is contained in:
parent
ab7dddea90
commit
e402887d5d
15 changed files with 5 additions and 6 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue