* 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/.
+++ /dev/null
-<div>foo</div><div>Bar</div>
+++ /dev/null
-<div>foo</div><p>Bar</p>
+++ /dev/null
-foo
-
-Bar
+++ /dev/null
-<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>
+++ /dev/null
-* 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.
+++ /dev/null
-<ol><li></li><li></li><li></li></ol>
+++ /dev/null
-1%20
-2%20
-3%20
+++ /dev/null
-<div class="gmail_extra">(progn</div><div class="gmail_extra"> (setq minibuffer-prompt-properties '(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"> "Turns on cursor-intangible-mode."</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>
+++ /dev/null
-(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))
+++ /dev/null
-<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>
+++ /dev/null
-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
+++ /dev/null
-<ul>
-<li></li>
-</ul>
-Lala
+++ /dev/null
-*
-
-Lala
\ No newline at end of file
--- /dev/null
+<div>foo</div><div>Bar</div>
--- /dev/null
+<div>foo</div><p>Bar</p>
--- /dev/null
+foo
+
+Bar
--- /dev/null
+<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>
--- /dev/null
+* 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.
--- /dev/null
+<ol><li></li><li></li><li></li></ol>
--- /dev/null
+1%20
+2%20
+3%20
--- /dev/null
+<div class="gmail_extra">(progn</div><div class="gmail_extra"> (setq minibuffer-prompt-properties '(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"> "Turns on cursor-intangible-mode."</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>
--- /dev/null
+(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))
--- /dev/null
+<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>
--- /dev/null
+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
--- /dev/null
+<ul>
+<li></li>
+</ul>
+Lala
--- /dev/null
+*
+
+Lala
\ No newline at end of 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))
(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))
(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))