summaryrefslogtreecommitdiff
path: root/test/lisp/net/shr-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/net/shr-tests.el')
-rw-r--r--test/lisp/net/shr-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index e71bd025de9..2254f9bc860 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -27,6 +27,8 @@
(require 'ert-x)
(require 'shr)
+(declare-function libxml-parse-html-region "xml.c")
+
(defun shr-test (name)
(with-temp-buffer
(insert-file-contents (format (concat (ert-resource-directory) "/%s.html") name))
@@ -65,6 +67,21 @@
(should-not
(shr--use-cookies-p "http://www.gnu.org" '("http://www.fsf.org")))))
+(ert-deftest shr-srcset ()
+ (should (equal (shr--parse-srcset "") nil))
+
+ (should (equal (shr--parse-srcset "a 10w, b 20w")
+ '(("b" 20) ("a" 10))))
+
+ (should (equal (shr--parse-srcset "a 10w b 20w")
+ '(("a" 10))))
+
+ (should (equal (shr--parse-srcset "https://example.org/1\n\n 10w , https://example.org/2 20w ")
+ '(("https://example.org/2" 20) ("https://example.org/1" 10))))
+
+ (should (equal (shr--parse-srcset "https://example.org/1,2\n\n 10w , https://example.org/2 20w ")
+ '(("https://example.org/2" 20) ("https://example.org/1,2" 10)))))
+
(require 'shr)
;;; shr-tests.el ends here