diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
commit | 650c20f1ca4e07591a727e1cfcc74b3363d15985 (patch) | |
tree | 85d11f6437cde22f410c25e0e5f71a3131ebd07d /test/src/xml-tests.el | |
parent | 8869332684c2302b5ba1ead4568bbc7ba1c0183e (diff) | |
parent | 4b85ae6a24380fb67a3315eaec9233f17a872473 (diff) | |
download | emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.gz emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.bz2 emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.zip |
Merge 'master' into noverlay
Diffstat (limited to 'test/src/xml-tests.el')
-rw-r--r-- | test/src/xml-tests.el | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el index 557e6da4524..6a8290bd0c8 100644 --- a/test/src/xml-tests.el +++ b/test/src/xml-tests.el @@ -1,6 +1,6 @@ -;;; libxml-parse-tests.el --- Test suite for libxml parsing. +;;; xml-tests.el --- Test suite for libxml parsing. -*- lexical-binding: t -*- -;; Copyright (C) 2014-2017 Free Software Foundation, Inc. +;; Copyright (C) 2014-2022 Free Software Foundation, Inc. ;; Author: Ulf Jasper <ulf.jasper@web.de> ;; Keywords: internal @@ -27,6 +27,8 @@ (require 'ert) +(declare-function libxml-parse-xml-region "xml.c") + (defvar libxml-tests--data-comments-preserved `(;; simple case ("<?xml version=\"1.0\"?><foo baz=\"true\">bar</foo>" @@ -42,33 +44,14 @@ (comment nil "comment-b") (comment nil "comment-c")))) "Alist of XML strings and their expected parse trees for preserved comments.") -(defvar libxml-tests--data-comments-discarded - `(;; simple case - ("<?xml version=\"1.0\"?><foo baz=\"true\">bar</foo>" - . (foo ((baz . "true")) "bar")) - ;; toplevel comments -- first document child must not get lost - (,(concat "<?xml version=\"1.0\"?><foo>bar</foo><!--comment-1-->" - "<!--comment-2-->") - . (foo nil "bar")) - (,(concat "<?xml version=\"1.0\"?><!--comment-a--><foo a=\"b\">" - "<bar>blub</bar></foo><!--comment-b--><!--comment-c-->") - . (foo ((a . "b")) (bar nil "blub")))) - "Alist of XML strings and their expected parse trees for discarded comments.") - - (ert-deftest libxml-tests () "Test libxml." - (when (fboundp 'libxml-parse-xml-region) - (with-temp-buffer - (dolist (test libxml-tests--data-comments-preserved) - (erase-buffer) - (insert (car test)) - (should (equal (cdr test) - (libxml-parse-xml-region (point-min) (point-max))))) - (dolist (test libxml-tests--data-comments-discarded) - (erase-buffer) - (insert (car test)) - (should (equal (cdr test) - (libxml-parse-xml-region (point-min) (point-max) nil t))))))) - -;;; libxml-tests.el ends here + (skip-unless (fboundp 'libxml-parse-xml-region)) + (with-temp-buffer + (dolist (test libxml-tests--data-comments-preserved) + (erase-buffer) + (insert (car test)) + (should (equal (cdr test) + (libxml-parse-xml-region (point-min) (point-max))))))) + +;;; xml-tests.el ends here |