]> git.eshelyaron.com Git - emacs.git/commitdiff
Move shr.el test data to follow our conventions
authorStefan Kangas <stefan@marxist.se>
Sat, 24 Oct 2020 00:28:45 +0000 (02:28 +0200)
committerStefan Kangas <stefan@marxist.se>
Sat, 24 Oct 2020 00:29:04 +0000 (02:29 +0200)
* 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/.

29 files changed:
test/data/shr/div-div.html [deleted file]
test/data/shr/div-div.txt [deleted file]
test/data/shr/div-p.html [deleted file]
test/data/shr/div-p.txt [deleted file]
test/data/shr/li-div.html [deleted file]
test/data/shr/li-div.txt [deleted file]
test/data/shr/li-empty.html [deleted file]
test/data/shr/li-empty.txt [deleted file]
test/data/shr/nonbr.html [deleted file]
test/data/shr/nonbr.txt [deleted file]
test/data/shr/ol.html [deleted file]
test/data/shr/ol.txt [deleted file]
test/data/shr/ul-empty.html [deleted file]
test/data/shr/ul-empty.txt [deleted file]
test/lisp/net/shr-resources/div-div.html [new file with mode: 0644]
test/lisp/net/shr-resources/div-div.txt [new file with mode: 0644]
test/lisp/net/shr-resources/div-p.html [new file with mode: 0644]
test/lisp/net/shr-resources/div-p.txt [new file with mode: 0644]
test/lisp/net/shr-resources/li-div.html [new file with mode: 0644]
test/lisp/net/shr-resources/li-div.txt [new file with mode: 0644]
test/lisp/net/shr-resources/li-empty.html [new file with mode: 0644]
test/lisp/net/shr-resources/li-empty.txt [new file with mode: 0644]
test/lisp/net/shr-resources/nonbr.html [new file with mode: 0644]
test/lisp/net/shr-resources/nonbr.txt [new file with mode: 0644]
test/lisp/net/shr-resources/ol.html [new file with mode: 0644]
test/lisp/net/shr-resources/ol.txt [new file with mode: 0644]
test/lisp/net/shr-resources/ul-empty.html [new file with mode: 0644]
test/lisp/net/shr-resources/ul-empty.txt [new file with mode: 0644]
test/lisp/net/shr-tests.el

diff --git a/test/data/shr/div-div.html b/test/data/shr/div-div.html
deleted file mode 100644 (file)
index 1c191ae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<div>foo</div><div>Bar</div>
diff --git a/test/data/shr/div-div.txt b/test/data/shr/div-div.txt
deleted file mode 100644 (file)
index 62715e1..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-foo
-Bar
diff --git a/test/data/shr/div-p.html b/test/data/shr/div-p.html
deleted file mode 100644 (file)
index fcbdfc4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<div>foo</div><p>Bar</p>
diff --git a/test/data/shr/div-p.txt b/test/data/shr/div-p.txt
deleted file mode 100644 (file)
index 859d731..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-foo
-
-Bar
diff --git a/test/data/shr/li-div.html b/test/data/shr/li-div.html
deleted file mode 100644 (file)
index eca3c51..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<ul>
-  <li>
-    <div>
-      <p >This is the first paragraph of a list item.</div>
-    <p >This is the second paragraph of a list item.</li>
-  <li>
-    <div>This is the first paragraph of a list item.</div>
-    <div>This is the second paragraph of a list item.</div>
-  </li>
-</ul>
diff --git a/test/data/shr/li-div.txt b/test/data/shr/li-div.txt
deleted file mode 100644 (file)
index 9fc54f2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-* This is the first paragraph of a list item.
-
-  This is the second paragraph of a list item.
-
-* This is the first paragraph of a list item.
-  This is the second paragraph of a list item.
diff --git a/test/data/shr/li-empty.html b/test/data/shr/li-empty.html
deleted file mode 100644 (file)
index 05cfee7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<ol><li></li><li></li><li></li></ol>
diff --git a/test/data/shr/li-empty.txt b/test/data/shr/li-empty.txt
deleted file mode 100644 (file)
index 906fd8d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-1%20
-2%20
-3%20
diff --git a/test/data/shr/nonbr.html b/test/data/shr/nonbr.html
deleted file mode 100644 (file)
index 56282cf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<div class="gmail_extra">(progn</div><div class="gmail_extra">  (setq minibuffer-prompt-properties &#39;(read-only t cursor-intangible t face minibuffer-prompt))</div><div class="gmail_extra"><br></div><div class="gmail_extra">  (defun turn-on-cursor-intangible-mode ()</div><div class="gmail_extra">    &quot;Turns on cursor-intangible-mode.&quot;</div><div class="gmail_extra">    (interactive)</div><div class="gmail_extra">    (cursor-intangible-mode 1))</div><div class="gmail_extra">  (define-globalized-minor-mode global-cursor-intangible-mode cursor-intangible-mode turn-on-cursor-intangible-mode)</div><div class="gmail_extra"><br></div><div class="gmail_extra">  (global-cursor-intangible-mode 1))</div><div class="gmail_extra"><br></div>
diff --git a/test/data/shr/nonbr.txt b/test/data/shr/nonbr.txt
deleted file mode 100644 (file)
index 0c3cffa..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-(progn
-  (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face
-minibuffer-prompt))
-
-  (defun turn-on-cursor-intangible-mode ()
-    "Turns on cursor-intangible-mode."
-    (interactive)
-    (cursor-intangible-mode 1))
-  (define-globalized-minor-mode global-cursor-intangible-mode
-cursor-intangible-mode turn-on-cursor-intangible-mode)
-
-  (global-cursor-intangible-mode 1))
diff --git a/test/data/shr/ol.html b/test/data/shr/ol.html
deleted file mode 100644 (file)
index f9a15f2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<ol>
-  <li>one</li>
-  <li>two</li>
-  <li>three</li>
-</ol>
-
-<ol start="10">
-  <li>ten</li>
-  <li>eleven</li>
-  <li>twelve</li>
-</ol>
-
-<ol start="0">
-  <li>zero</li>
-  <li>one</li>
-  <li>two</li>
-</ol>
-
-<ol start="-5">
-  <li>minus five</li>
-  <li>minus four</li>
-  <li>minus three</li>
-</ol>
-
-<ol start="notanumber">
-  <li>one</li>
-  <li>two</li>
-  <li>three</li>
-</ol>
diff --git a/test/data/shr/ol.txt b/test/data/shr/ol.txt
deleted file mode 100644 (file)
index 0d46e2a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-1 one
-2 two
-3 three
-
-10 ten
-11 eleven
-12 twelve
-
-0 zero
-1 one
-2 two
-
--5 minus five
--4 minus four
--3 minus three
-
-1 one
-2 two
-3 three
diff --git a/test/data/shr/ul-empty.html b/test/data/shr/ul-empty.html
deleted file mode 100644 (file)
index e5a75ab..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<ul>
-<li></li>
-</ul>
-Lala
diff --git a/test/data/shr/ul-empty.txt b/test/data/shr/ul-empty.txt
deleted file mode 100644 (file)
index 8993555..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-* 
-
-Lala 
\ No newline at end of file
diff --git a/test/lisp/net/shr-resources/div-div.html b/test/lisp/net/shr-resources/div-div.html
new file mode 100644 (file)
index 0000000..1c191ae
--- /dev/null
@@ -0,0 +1 @@
+<div>foo</div><div>Bar</div>
diff --git a/test/lisp/net/shr-resources/div-div.txt b/test/lisp/net/shr-resources/div-div.txt
new file mode 100644 (file)
index 0000000..62715e1
--- /dev/null
@@ -0,0 +1,2 @@
+foo
+Bar
diff --git a/test/lisp/net/shr-resources/div-p.html b/test/lisp/net/shr-resources/div-p.html
new file mode 100644 (file)
index 0000000..fcbdfc4
--- /dev/null
@@ -0,0 +1 @@
+<div>foo</div><p>Bar</p>
diff --git a/test/lisp/net/shr-resources/div-p.txt b/test/lisp/net/shr-resources/div-p.txt
new file mode 100644 (file)
index 0000000..859d731
--- /dev/null
@@ -0,0 +1,3 @@
+foo
+
+Bar
diff --git a/test/lisp/net/shr-resources/li-div.html b/test/lisp/net/shr-resources/li-div.html
new file mode 100644 (file)
index 0000000..eca3c51
--- /dev/null
@@ -0,0 +1,10 @@
+<ul>
+  <li>
+    <div>
+      <p >This is the first paragraph of a list item.</div>
+    <p >This is the second paragraph of a list item.</li>
+  <li>
+    <div>This is the first paragraph of a list item.</div>
+    <div>This is the second paragraph of a list item.</div>
+  </li>
+</ul>
diff --git a/test/lisp/net/shr-resources/li-div.txt b/test/lisp/net/shr-resources/li-div.txt
new file mode 100644 (file)
index 0000000..9fc54f2
--- /dev/null
@@ -0,0 +1,6 @@
+* This is the first paragraph of a list item.
+
+  This is the second paragraph of a list item.
+
+* This is the first paragraph of a list item.
+  This is the second paragraph of a list item.
diff --git a/test/lisp/net/shr-resources/li-empty.html b/test/lisp/net/shr-resources/li-empty.html
new file mode 100644 (file)
index 0000000..05cfee7
--- /dev/null
@@ -0,0 +1 @@
+<ol><li></li><li></li><li></li></ol>
diff --git a/test/lisp/net/shr-resources/li-empty.txt b/test/lisp/net/shr-resources/li-empty.txt
new file mode 100644 (file)
index 0000000..906fd8d
--- /dev/null
@@ -0,0 +1,3 @@
+1%20
+2%20
+3%20
diff --git a/test/lisp/net/shr-resources/nonbr.html b/test/lisp/net/shr-resources/nonbr.html
new file mode 100644 (file)
index 0000000..56282cf
--- /dev/null
@@ -0,0 +1 @@
+<div class="gmail_extra">(progn</div><div class="gmail_extra">  (setq minibuffer-prompt-properties &#39;(read-only t cursor-intangible t face minibuffer-prompt))</div><div class="gmail_extra"><br></div><div class="gmail_extra">  (defun turn-on-cursor-intangible-mode ()</div><div class="gmail_extra">    &quot;Turns on cursor-intangible-mode.&quot;</div><div class="gmail_extra">    (interactive)</div><div class="gmail_extra">    (cursor-intangible-mode 1))</div><div class="gmail_extra">  (define-globalized-minor-mode global-cursor-intangible-mode cursor-intangible-mode turn-on-cursor-intangible-mode)</div><div class="gmail_extra"><br></div><div class="gmail_extra">  (global-cursor-intangible-mode 1))</div><div class="gmail_extra"><br></div>
diff --git a/test/lisp/net/shr-resources/nonbr.txt b/test/lisp/net/shr-resources/nonbr.txt
new file mode 100644 (file)
index 0000000..0c3cffa
--- /dev/null
@@ -0,0 +1,12 @@
+(progn
+  (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face
+minibuffer-prompt))
+
+  (defun turn-on-cursor-intangible-mode ()
+    "Turns on cursor-intangible-mode."
+    (interactive)
+    (cursor-intangible-mode 1))
+  (define-globalized-minor-mode global-cursor-intangible-mode
+cursor-intangible-mode turn-on-cursor-intangible-mode)
+
+  (global-cursor-intangible-mode 1))
diff --git a/test/lisp/net/shr-resources/ol.html b/test/lisp/net/shr-resources/ol.html
new file mode 100644 (file)
index 0000000..f9a15f2
--- /dev/null
@@ -0,0 +1,29 @@
+<ol>
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
+
+<ol start="10">
+  <li>ten</li>
+  <li>eleven</li>
+  <li>twelve</li>
+</ol>
+
+<ol start="0">
+  <li>zero</li>
+  <li>one</li>
+  <li>two</li>
+</ol>
+
+<ol start="-5">
+  <li>minus five</li>
+  <li>minus four</li>
+  <li>minus three</li>
+</ol>
+
+<ol start="notanumber">
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
diff --git a/test/lisp/net/shr-resources/ol.txt b/test/lisp/net/shr-resources/ol.txt
new file mode 100644 (file)
index 0000000..0d46e2a
--- /dev/null
@@ -0,0 +1,19 @@
+1 one
+2 two
+3 three
+
+10 ten
+11 eleven
+12 twelve
+
+0 zero
+1 one
+2 two
+
+-5 minus five
+-4 minus four
+-3 minus three
+
+1 one
+2 two
+3 three
diff --git a/test/lisp/net/shr-resources/ul-empty.html b/test/lisp/net/shr-resources/ul-empty.html
new file mode 100644 (file)
index 0000000..e5a75ab
--- /dev/null
@@ -0,0 +1,4 @@
+<ul>
+<li></li>
+</ul>
+Lala
diff --git a/test/lisp/net/shr-resources/ul-empty.txt b/test/lisp/net/shr-resources/ul-empty.txt
new file mode 100644 (file)
index 0000000..8993555
--- /dev/null
@@ -0,0 +1,3 @@
+* 
+
+Lala 
\ No newline at end of file
index 88a31bcf645f4e936ccd106a73c2299da6660757..abc4f6a656b1bd425d34cfcc93d6f3adf9a25872 100644 (file)
 
 ;;; 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))