emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e402887 2/4: Move shr.el test data to follow our conventions


From: Stefan Kangas
Subject: master e402887 2/4: Move shr.el test data to follow our conventions
Date: Fri, 23 Oct 2020 21:41:45 -0400 (EDT)

branch: master
commit e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    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/.
---
 test/{data/shr => lisp/net/shr-resources}/div-div.html  |  0
 test/{data/shr => lisp/net/shr-resources}/div-div.txt   |  0
 test/{data/shr => lisp/net/shr-resources}/div-p.html    |  0
 test/{data/shr => lisp/net/shr-resources}/div-p.txt     |  0
 test/{data/shr => lisp/net/shr-resources}/li-div.html   |  0
 test/{data/shr => lisp/net/shr-resources}/li-div.txt    |  0
 test/{data/shr => lisp/net/shr-resources}/li-empty.html |  0
 test/{data/shr => lisp/net/shr-resources}/li-empty.txt  |  0
 test/{data/shr => lisp/net/shr-resources}/nonbr.html    |  0
 test/{data/shr => lisp/net/shr-resources}/nonbr.txt     |  0
 test/{data/shr => lisp/net/shr-resources}/ol.html       |  0
 test/{data/shr => lisp/net/shr-resources}/ol.txt        |  0
 test/{data/shr => lisp/net/shr-resources}/ul-empty.html |  0
 test/{data/shr => lisp/net/shr-resources}/ul-empty.txt  |  0
 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
similarity index 100%
rename from test/data/shr/div-div.html
rename to 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
similarity index 100%
rename from test/data/shr/div-div.txt
rename to 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
similarity index 100%
rename from test/data/shr/div-p.html
rename to 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
similarity index 100%
rename from test/data/shr/div-p.txt
rename to 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
similarity index 100%
rename from test/data/shr/li-div.html
rename to 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
similarity index 100%
rename from test/data/shr/li-div.txt
rename to 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
similarity index 100%
rename from test/data/shr/li-empty.html
rename to 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
similarity index 100%
rename from test/data/shr/li-empty.txt
rename to test/lisp/net/shr-resources/li-empty.txt
diff --git a/test/data/shr/nonbr.html b/test/lisp/net/shr-resources/nonbr.html
similarity index 100%
rename from test/data/shr/nonbr.html
rename to test/lisp/net/shr-resources/nonbr.html
diff --git a/test/data/shr/nonbr.txt b/test/lisp/net/shr-resources/nonbr.txt
similarity index 100%
rename from test/data/shr/nonbr.txt
rename to test/lisp/net/shr-resources/nonbr.txt
diff --git a/test/data/shr/ol.html b/test/lisp/net/shr-resources/ol.html
similarity index 100%
rename from test/data/shr/ol.html
rename to test/lisp/net/shr-resources/ol.html
diff --git a/test/data/shr/ol.txt b/test/lisp/net/shr-resources/ol.txt
similarity index 100%
rename from test/data/shr/ol.txt
rename to 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
similarity index 100%
rename from test/data/shr/ul-empty.html
rename to 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
similarity index 100%
rename from test/data/shr/ul-empty.txt
rename to 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 88a31bc..abc4f6a 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]