1 ;;; libxml-parse-tests.el --- Test suite for libxml parsing.
3 ;; Copyright (C) 2014 Free Software Foundation, Inc.
5 ;; Author: Ulf Jasper <ulf.jasper@web.de>
7 ;; Human-Keywords: internal
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
30 (defvar libxml-tests--data
32 ("<?xml version=\"1.0\"?><foo baz=\"true\">bar</foo>"
33 .
(foo ((baz .
"true")) "bar"))
34 ;; toplevel comments -- first document child must not get lost
35 (,(concat "<?xml version=\"1.0\"?><foo>bar</foo><!--comment-1-->"
37 .
(top nil
(foo nil
"bar") (comment nil
"comment-1")
38 (comment nil
"comment-2")))
39 (,(concat "<?xml version=\"1.0\"?><!--comment-a--><foo a=\"b\">"
40 "<bar>blub</bar></foo><!--comment-b--><!--comment-c-->")
41 .
(top nil
(comment nil
"comment-a") (foo ((a .
"b")) (bar nil
"blub"))
42 (comment nil
"comment-b") (comment nil
"comment-c"))))
43 "Alist of XML strings and their expected parse trees.")
46 (ert-deftest libxml-tests
()
48 (when (fboundp 'libxml-parse-xml-region
)
50 (dolist (test libxml-tests--data
)
53 (should (equal (cdr test
)
54 (libxml-parse-xml-region (point-min) (point-max))))))))
56 ;;; libxml-tests.el ends here