From: Stefan Kangas Date: Sat, 24 Oct 2020 00:28:45 +0000 (+0200) Subject: Move shr.el test data to follow our conventions X-Git-Tag: emacs-28.0.90~5460 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e402887d5d2f7cfc5e3f1cb2a9e629bce782e0a8;p=emacs.git 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/. --- diff --git a/test/data/shr/div-div.html b/test/data/shr/div-div.html deleted file mode 100644 index 1c191ae44d8..00000000000 --- a/test/data/shr/div-div.html +++ /dev/null @@ -1 +0,0 @@ -
foo
Bar
diff --git a/test/data/shr/div-div.txt b/test/data/shr/div-div.txt deleted file mode 100644 index 62715e12513..00000000000 --- a/test/data/shr/div-div.txt +++ /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 index fcbdfc43293..00000000000 --- a/test/data/shr/div-p.html +++ /dev/null @@ -1 +0,0 @@ -
foo

Bar

diff --git a/test/data/shr/div-p.txt b/test/data/shr/div-p.txt deleted file mode 100644 index 859d731da89..00000000000 --- a/test/data/shr/div-p.txt +++ /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 index eca3c511bd9..00000000000 --- a/test/data/shr/li-div.html +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/test/data/shr/li-div.txt b/test/data/shr/li-div.txt deleted file mode 100644 index 9fc54f2bdc6..00000000000 --- a/test/data/shr/li-div.txt +++ /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 index 05cfee7bdd4..00000000000 --- a/test/data/shr/li-empty.html +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/data/shr/li-empty.txt b/test/data/shr/li-empty.txt deleted file mode 100644 index 906fd8df8b3..00000000000 --- a/test/data/shr/li-empty.txt +++ /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 index 56282cf4ca5..00000000000 --- a/test/data/shr/nonbr.html +++ /dev/null @@ -1 +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/nonbr.txt b/test/data/shr/nonbr.txt deleted file mode 100644 index 0c3cffa93f9..00000000000 --- a/test/data/shr/nonbr.txt +++ /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 index f9a15f26409..00000000000 --- a/test/data/shr/ol.html +++ /dev/null @@ -1,29 +0,0 @@ -
    -
  1. one
  2. -
  3. two
  4. -
  5. three
  6. -
- -
    -
  1. ten
  2. -
  3. eleven
  4. -
  5. twelve
  6. -
- -
    -
  1. zero
  2. -
  3. one
  4. -
  5. two
  6. -
- -
    -
  1. minus five
  2. -
  3. minus four
  4. -
  5. minus three
  6. -
- -
    -
  1. one
  2. -
  3. two
  4. -
  5. three
  6. -
diff --git a/test/data/shr/ol.txt b/test/data/shr/ol.txt deleted file mode 100644 index 0d46e2a8ddb..00000000000 --- a/test/data/shr/ol.txt +++ /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 index e5a75ab9216..00000000000 --- a/test/data/shr/ul-empty.html +++ /dev/null @@ -1,4 +0,0 @@ - -Lala diff --git a/test/data/shr/ul-empty.txt b/test/data/shr/ul-empty.txt deleted file mode 100644 index 8993555425b..00000000000 --- a/test/data/shr/ul-empty.txt +++ /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 index 00000000000..1c191ae44d8 --- /dev/null +++ b/test/lisp/net/shr-resources/div-div.html @@ -0,0 +1 @@ +
foo
Bar
diff --git a/test/lisp/net/shr-resources/div-div.txt b/test/lisp/net/shr-resources/div-div.txt new file mode 100644 index 00000000000..62715e12513 --- /dev/null +++ b/test/lisp/net/shr-resources/div-div.txt @@ -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 index 00000000000..fcbdfc43293 --- /dev/null +++ b/test/lisp/net/shr-resources/div-p.html @@ -0,0 +1 @@ +
foo

Bar

diff --git a/test/lisp/net/shr-resources/div-p.txt b/test/lisp/net/shr-resources/div-p.txt new file mode 100644 index 00000000000..859d731da89 --- /dev/null +++ b/test/lisp/net/shr-resources/div-p.txt @@ -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 index 00000000000..eca3c511bd9 --- /dev/null +++ b/test/lisp/net/shr-resources/li-div.html @@ -0,0 +1,10 @@ + diff --git a/test/lisp/net/shr-resources/li-div.txt b/test/lisp/net/shr-resources/li-div.txt new file mode 100644 index 00000000000..9fc54f2bdc6 --- /dev/null +++ b/test/lisp/net/shr-resources/li-div.txt @@ -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 index 00000000000..05cfee7bdd4 --- /dev/null +++ b/test/lisp/net/shr-resources/li-empty.html @@ -0,0 +1 @@ +
diff --git a/test/lisp/net/shr-resources/li-empty.txt b/test/lisp/net/shr-resources/li-empty.txt new file mode 100644 index 00000000000..906fd8df8b3 --- /dev/null +++ b/test/lisp/net/shr-resources/li-empty.txt @@ -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 index 00000000000..56282cf4ca5 --- /dev/null +++ b/test/lisp/net/shr-resources/nonbr.html @@ -0,0 +1 @@ +
(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/nonbr.txt b/test/lisp/net/shr-resources/nonbr.txt new file mode 100644 index 00000000000..0c3cffa93f9 --- /dev/null +++ b/test/lisp/net/shr-resources/nonbr.txt @@ -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 index 00000000000..f9a15f26409 --- /dev/null +++ b/test/lisp/net/shr-resources/ol.html @@ -0,0 +1,29 @@ +
    +
  1. one
  2. +
  3. two
  4. +
  5. three
  6. +
+ +
    +
  1. ten
  2. +
  3. eleven
  4. +
  5. twelve
  6. +
+ +
    +
  1. zero
  2. +
  3. one
  4. +
  5. two
  6. +
+ +
    +
  1. minus five
  2. +
  3. minus four
  4. +
  5. minus three
  6. +
+ +
    +
  1. one
  2. +
  3. two
  4. +
  5. three
  6. +
diff --git a/test/lisp/net/shr-resources/ol.txt b/test/lisp/net/shr-resources/ol.txt new file mode 100644 index 00000000000..0d46e2a8ddb --- /dev/null +++ b/test/lisp/net/shr-resources/ol.txt @@ -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 index 00000000000..e5a75ab9216 --- /dev/null +++ b/test/lisp/net/shr-resources/ul-empty.html @@ -0,0 +1,4 @@ + +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 index 00000000000..8993555425b --- /dev/null +++ b/test/lisp/net/shr-resources/ul-empty.txt @@ -0,0 +1,3 @@ +* + +Lala \ No newline at end of file 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 @@ ;;; 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))