diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-05-22 07:39:32 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-08 20:53:45 +0200 |
commit | d464fb1f18173fea1aa3028cf44002944419b6ee (patch) | |
tree | 28bc651508014a950e3f994ad0b741f4ba4eea14 /tests | |
parent | 1359fb6d7a76609ec07e22af9cd79ae604d23d20 (diff) | |
download | gobject-introspection-d464fb1f18173fea1aa3028cf44002944419b6ee.tar.gz |
tests: validate GTK-Doc test files
This is more of a handy developer tool than something
that is always expected to be executed as part of the
test suite, so we don't add a hard dependency on xmllint.
https://bugzilla.gnome.org/show_bug.cgi?id=688897
Diffstat (limited to 'tests')
47 files changed, 289 insertions, 90 deletions
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am index a3069a8b..c0a4b125 100644 --- a/tests/scanner/Makefile.am +++ b/tests/scanner/Makefile.am @@ -199,6 +199,7 @@ EXTRA_DIST += \ annotationparser/README \ annotationparser/test_parser.py \ annotationparser/test_patterns.py \ + annotationparser/tests.xsd \ annotationparser/gi/annotation_allow_none.xml \ annotationparser/gi/annotation_array.xml \ annotationparser/gi/annotation_closure.xml \ diff --git a/tests/scanner/annotationparser/gi/annotation_allow_none.xml b/tests/scanner/annotationparser/gi/annotation_allow_none.xml index dba0f93d..8b8ca3ec 100644 --- a/tests/scanner/annotationparser/gi/annotation_allow_none.xml +++ b/tests/scanner/annotationparser/gi/annotation_allow_none.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index 062c7724..a59c267a 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_closure.xml b/tests/scanner/annotationparser/gi/annotation_closure.xml index 83bcdded..cd431f00 100644 --- a/tests/scanner/annotationparser/gi/annotation_closure.xml +++ b/tests/scanner/annotationparser/gi/annotation_closure.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_constructor.xml b/tests/scanner/annotationparser/gi/annotation_constructor.xml index a4cfc465..65ee93d5 100644 --- a/tests/scanner/annotationparser/gi/annotation_constructor.xml +++ b/tests/scanner/annotationparser/gi/annotation_constructor.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_destroy.xml b/tests/scanner/annotationparser/gi/annotation_destroy.xml index d322dbb3..9fd8a26b 100644 --- a/tests/scanner/annotationparser/gi/annotation_destroy.xml +++ b/tests/scanner/annotationparser/gi/annotation_destroy.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_element_type.xml b/tests/scanner/annotationparser/gi/annotation_element_type.xml index 6a87530f..30fffafc 100644 --- a/tests/scanner/annotationparser/gi/annotation_element_type.xml +++ b/tests/scanner/annotationparser/gi/annotation_element_type.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_foreign.xml b/tests/scanner/annotationparser/gi/annotation_foreign.xml index 1e6e9f4a..2f90ac11 100644 --- a/tests/scanner/annotationparser/gi/annotation_foreign.xml +++ b/tests/scanner/annotationparser/gi/annotation_foreign.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_get_value_func.xml b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml index 70760ea9..ab71a7db 100644 --- a/tests/scanner/annotationparser/gi/annotation_get_value_func.xml +++ b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_in.xml b/tests/scanner/annotationparser/gi/annotation_in.xml index 627f504d..4e9be4fe 100644 --- a/tests/scanner/annotationparser/gi/annotation_in.xml +++ b/tests/scanner/annotationparser/gi/annotation_in.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_in_out.xml b/tests/scanner/annotationparser/gi/annotation_in_out.xml index f12fffe5..cb489577 100644 --- a/tests/scanner/annotationparser/gi/annotation_in_out.xml +++ b/tests/scanner/annotationparser/gi/annotation_in_out.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_method.xml b/tests/scanner/annotationparser/gi/annotation_method.xml index 7fb8192f..37c910c2 100644 --- a/tests/scanner/annotationparser/gi/annotation_method.xml +++ b/tests/scanner/annotationparser/gi/annotation_method.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_out.xml b/tests/scanner/annotationparser/gi/annotation_out.xml index c548ec83..7b7c1e14 100644 --- a/tests/scanner/annotationparser/gi/annotation_out.xml +++ b/tests/scanner/annotationparser/gi/annotation_out.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_ref_func.xml b/tests/scanner/annotationparser/gi/annotation_ref_func.xml index 91610dce..9d159c1e 100644 --- a/tests/scanner/annotationparser/gi/annotation_ref_func.xml +++ b/tests/scanner/annotationparser/gi/annotation_ref_func.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_rename_to.xml b/tests/scanner/annotationparser/gi/annotation_rename_to.xml index 3d1204d7..dc79d18e 100644 --- a/tests/scanner/annotationparser/gi/annotation_rename_to.xml +++ b/tests/scanner/annotationparser/gi/annotation_rename_to.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_scope.xml b/tests/scanner/annotationparser/gi/annotation_scope.xml index e8693075..008591d6 100644 --- a/tests/scanner/annotationparser/gi/annotation_scope.xml +++ b/tests/scanner/annotationparser/gi/annotation_scope.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_set_value_func.xml b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml index 20f3e26b..5418c9cd 100644 --- a/tests/scanner/annotationparser/gi/annotation_set_value_func.xml +++ b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_skip.xml b/tests/scanner/annotationparser/gi/annotation_skip.xml index b6aa3d79..396a4951 100644 --- a/tests/scanner/annotationparser/gi/annotation_skip.xml +++ b/tests/scanner/annotationparser/gi/annotation_skip.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_transfer.xml b/tests/scanner/annotationparser/gi/annotation_transfer.xml index 927c4929..511f24d3 100644 --- a/tests/scanner/annotationparser/gi/annotation_transfer.xml +++ b/tests/scanner/annotationparser/gi/annotation_transfer.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_type.xml b/tests/scanner/annotationparser/gi/annotation_type.xml index 6a8539ec..16d45319 100644 --- a/tests/scanner/annotationparser/gi/annotation_type.xml +++ b/tests/scanner/annotationparser/gi/annotation_type.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/annotation_unref_func.xml b/tests/scanner/annotationparser/gi/annotation_unref_func.xml index 6dad3f31..32bd8921 100644 --- a/tests/scanner/annotationparser/gi/annotation_unref_func.xml +++ b/tests/scanner/annotationparser/gi/annotation_unref_func.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_value.xml b/tests/scanner/annotationparser/gi/annotation_value.xml index f111d6b7..e7c7d6f1 100644 --- a/tests/scanner/annotationparser/gi/annotation_value.xml +++ b/tests/scanner/annotationparser/gi/annotation_value.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/annotation_virtual.xml b/tests/scanner/annotationparser/gi/annotation_virtual.xml index 189d56bd..ae8c3be6 100644 --- a/tests/scanner/annotationparser/gi/annotation_virtual.xml +++ b/tests/scanner/annotationparser/gi/annotation_virtual.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/syntax.xml b/tests/scanner/annotationparser/gi/syntax.xml index 4bbe1867..1bb86520 100644 --- a/tests/scanner/annotationparser/gi/syntax.xml +++ b/tests/scanner/annotationparser/gi/syntax.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/syntax_identifier.xml b/tests/scanner/annotationparser/gi/syntax_identifier.xml index 9aae28e0..bd7d5c5c 100644 --- a/tests/scanner/annotationparser/gi/syntax_identifier.xml +++ b/tests/scanner/annotationparser/gi/syntax_identifier.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/syntax_nested_tags.xml b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml index 00fcabb7..b3eaab5e 100644 --- a/tests/scanner/annotationparser/gi/syntax_nested_tags.xml +++ b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml index 88616235..3303af42 100644 --- a/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml +++ b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <!-- diff --git a/tests/scanner/annotationparser/gi/tag_deprecated.xml b/tests/scanner/annotationparser/gi/tag_deprecated.xml index b43d8a21..abb6b4dd 100644 --- a/tests/scanner/annotationparser/gi/tag_deprecated.xml +++ b/tests/scanner/annotationparser/gi/tag_deprecated.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/tag_description.xml b/tests/scanner/annotationparser/gi/tag_description.xml index 1627cd4b..f16c9d36 100644 --- a/tests/scanner/annotationparser/gi/tag_description.xml +++ b/tests/scanner/annotationparser/gi/tag_description.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml b/tests/scanner/annotationparser/gi/tag_returns.xml index 5506a6f8..23c29a71 100644 --- a/tests/scanner/annotationparser/gi/tag_returns.xml +++ b/tests/scanner/annotationparser/gi/tag_returns.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** @@ -15,13 +15,13 @@ <identifier> <name>annotation_object_string_out</name> </identifier> + <description>Test returning a string as an out parameter</description> <tags> <tag> <name>returns</name> <description>some boolean</description> </tag> </tags> - <description>Test returning a string as an out parameter</description> </docblock> </parser> </test> @@ -42,13 +42,13 @@ <identifier> <name>annotation_object_string_out</name> </identifier> + <description>Test returning a string as an out parameter</description> <tags> <tag> <name>returns</name> <description>some boolean</description> </tag> </tags> - <description>Test returning a string as an out parameter</description> </docblock> </parser> </test> @@ -68,13 +68,13 @@ <identifier> <name>annotation_object_string_out</name> </identifier> + <description>Test returning a string as an out parameter</description> <tags> <tag> <name>returns</name> <description>some boolean</description> </tag> </tags> - <description>Test returning a string as an out parameter</description> </docblock> </parser> </test> diff --git a/tests/scanner/annotationparser/gi/tag_since.xml b/tests/scanner/annotationparser/gi/tag_since.xml index 15eb7d3c..a2dbb89e 100644 --- a/tests/scanner/annotationparser/gi/tag_since.xml +++ b/tests/scanner/annotationparser/gi/tag_since.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gi/tag_stability.xml b/tests/scanner/annotationparser/gi/tag_stability.xml index 2f816ab2..31862f03 100644 --- a/tests/scanner/annotationparser/gi/tag_stability.xml +++ b/tests/scanner/annotationparser/gi/tag_stability.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml b/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml index c8dd01da..a39b1502 100644 --- a/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/annotations/tester.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml b/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml index 92b7b2db..6d00aa36 100644 --- a/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/annotations/tester.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml b/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml index dd05970b..b8aea1ac 100644 --- a/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/bugs/tester.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input><![CDATA[/** diff --git a/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml b/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml index 4846a539..39fe878d 100644 --- a/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/bugs/tester.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml b/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml index 4dcc994e..6419370a 100644 --- a/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/empty/tester.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input><![CDATA[/** diff --git a/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml b/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml index 6e2bb01f..f76efdda 100644 --- a/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/fail/tester.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/* diff --git a/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml b/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml index 0663911b..2076e526 100644 --- a/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/fail/tester.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml b/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml index 6511533d..65dca481 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/giface.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input><![CDATA[/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml b/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml index c9271531..58c22857 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/giface.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml index ef825d86..1f619408 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input><![CDATA[/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml index 4e9f7c8e..66627b55 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/gobject.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml index eed69430..78f11b27 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.c.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml index d77ec1a6..4965adbe 100644 --- a/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml +++ b/tests/scanner/annotationparser/gtkdoc/gobject/gtypes.h.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<tests> +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> <test> <input>/** diff --git a/tests/scanner/annotationparser/test_parser.py b/tests/scanner/annotationparser/test_parser.py index 71b399ea..2ebb6c28 100644 --- a/tests/scanner/annotationparser/test_parser.py +++ b/tests/scanner/annotationparser/test_parser.py @@ -29,25 +29,51 @@ continues to function correctly. import difflib import os -import xml.etree.ElementTree as etree +import subprocess import unittest +import xml.etree.ElementTree as etree from giscanner.annotationparser import AnnotationParser from giscanner.ast import Namespace from giscanner.message import MessageLogger +XML_NS = 'http://schemas.gnome.org/gobject-introspection/2013/test' +XML_SCHEMA = os.path.abspath(os.path.join(os.path.dirname(__file__), 'tests.xsd')) +XML_LINT = None + + +def ns(x): + return x.replace('{}', '{%s}' % (XML_NS, )) + + +def validate(tests_file): + global XML_LINT + + try: + cmd = ['xmllint', '--noout', '--nonet', '--schema', XML_SCHEMA, tests_file] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout, stderr = p.communicate() + except OSError: + if XML_LINT is None: + XML_LINT = False + print('warning: xmllint not found, validation of test definition files will be skipped') + else: + if p.returncode != 0: + raise SystemExit(stdout) + + class TestCommentBlock(unittest.TestCase): @classmethod def __create_test__(cls, testcase): def do_test(self): # Parse GTK-Doc comment block - commentblock = testcase.find('input').text + commentblock = testcase.find(ns('{}input')).text parsed_docblock = AnnotationParser().parse_comment_block((commentblock, 'test.c', 1)) parsed_tree = self.parsed2tree(parsed_docblock).split('\n') - # Get expected output - expected_docblock = testcase.find('parser/docblock') + # Get expected parser output + expected_docblock = testcase.find(ns('{}parser/{}docblock')) expected_tree = self.expected2tree(expected_docblock).split('\n') # Construct a meaningful message @@ -167,86 +193,86 @@ class TestCommentBlock(unittest.TestCase): if docblock is not None: expected += '<docblock>\n' - if docblock.find('identifier') is not None: + if docblock.find(ns('{}identifier')) is not None: expected += ' <identifier>\n' # Expecting an identifier name is required, don't bother checking if it's there or not - expected += ' <name>%s</name>\n' % (docblock.find('identifier/name').text, ) - annotations = docblock.find('identifier/annotations') + expected += ' <name>%s</name>\n' % (docblock.find(ns('{}identifier/{}name')).text, ) + annotations = docblock.find(ns('{}identifier/{}annotations')) if annotations is not None: expected += ' <annotations>\n' - for annotation in annotations.findall('annotation'): + for annotation in annotations.findall(ns('{}annotation')): expected += ' <annotation>\n' - expected += ' <name>%s</name>\n' % (annotation.find('name').text, ) - if annotation.find('options') is not None: + expected += ' <name>%s</name>\n' % (annotation.find(ns('{}name')).text, ) + if annotation.find(ns('{}options')) is not None: expected += ' <options>\n' - for option in annotation.findall('options/option'): + for option in annotation.findall(ns('{}options/{}option')): expected += ' <option>\n' - expected += ' <name>%s</name>\n' % (option.find('name').text, ) + expected += ' <name>%s</name>\n' % (option.find(ns('{}name')).text, ) if option.find('value') is not None: - expected += ' <value>%s</value>\n' % (option.find('value').text, ) + expected += ' <value>%s</value>\n' % (option.find(ns('{}value')).text, ) expected += ' </option>\n' expected += ' </options>\n' expected += ' </annotation>\n' expected += ' </annotations>\n' expected += ' </identifier>\n' - parameters = docblock.find('parameters') + parameters = docblock.find(ns('{}parameters')) if parameters is not None: expected += ' <parameters>\n' - for parameter in parameters.findall('parameter'): + for parameter in parameters.findall(ns('{}parameter')): expected += ' <parameter>\n' - expected += ' <name>%s</name>\n' % (parameter.find('name').text, ) - annotations = parameter.find('annotations') + expected += ' <name>%s</name>\n' % (parameter.find(ns('{}name')).text, ) + annotations = parameter.find(ns('{}annotations')) if annotations is not None: expected += ' <annotations>\n' - for annotation in parameter.findall('annotations/annotation'): + for annotation in parameter.findall(ns('{}annotations/{}annotation')): expected += ' <annotation>\n' - expected += ' <name>%s</name>\n' % (annotation.find('name').text, ) - if annotation.find('options') is not None: + expected += ' <name>%s</name>\n' % (annotation.find(ns('{}name')).text, ) + if annotation.find(ns('{}options')) is not None: expected += ' <options>\n' - for option in annotation.findall('options/option'): + for option in annotation.findall(ns('{}options/{}option')): expected += ' <option>\n' - expected += ' <name>%s</name>\n' % (option.find('name').text, ) - if option.find('value') is not None: - expected += ' <value>%s</value>\n' % (option.find('value').text, ) + expected += ' <name>%s</name>\n' % (option.find(ns('{}name')).text, ) + if option.find(ns('{}value')) is not None: + expected += ' <value>%s</value>\n' % (option.find(ns('{}value')).text, ) expected += ' </option>\n' expected += ' </options>\n' expected += ' </annotation>\n' expected += ' </annotations>\n' - if parameter.find('description') is not None: - expected += ' <description>%s</description>\n' % (parameter.find('description').text, ) + if parameter.find(ns('{}description')) is not None: + expected += ' <description>%s</description>\n' % (parameter.find(ns('{}description')).text, ) expected += ' </parameter>\n' expected += ' </parameters>\n' - description = docblock.find('description') + description = docblock.find(ns('{}description')) if description is not None: expected += ' <description>%s</description>\n' % (description.text, ) - tags = docblock.find('tags') + tags = docblock.find(ns('{}tags')) if tags is not None: expected += ' <tags>\n' - for tag in tags.findall('tag'): + for tag in tags.findall(ns('{}tag')): expected += ' <tag>\n' - expected += ' <name>%s</name>\n' % (tag.find('name').text, ) - annotations = tag.find('annotations') + expected += ' <name>%s</name>\n' % (tag.find(ns('{}name')).text, ) + annotations = tag.find(ns('{}annotations')) if annotations is not None: expected += ' <annotations>\n' - for annotation in tag.findall('annotations/annotation'): + for annotation in tag.findall(ns('{}annotations/{}annotation')): expected += ' <annotation>\n' - expected += ' <name>%s</name>\n' % (annotation.find('name').text, ) - if annotation.find('options') is not None: + expected += ' <name>%s</name>\n' % (annotation.find(ns('{}name')).text, ) + if annotation.find(ns('{}options')) is not None: expected += ' <options>\n' - for option in annotation.findall('options/option'): + for option in annotation.findall(ns('{}options/{}option')): expected += ' <option>\n' - expected += ' <name>%s</name>\n' % (option.find('name').text, ) - if option.find('value') is not None: - expected += ' <value>%s</value>\n' % (option.find('value').text, ) + expected += ' <name>%s</name>\n' % (option.find(ns('{}name')).text, ) + if option.find(ns('{}value')) is not None: + expected += ' <value>%s</value>\n' % (option.find(ns('{}value')).text, ) expected += ' </option>\n' expected += ' </options>\n' expected += ' </annotation>\n' expected += ' </annotations>\n' - if tag.find('description') is not None: - expected += ' <description>%s</description>\n' % (tag.find('description').text, ) + if tag.find(ns('{}description')) is not None: + expected += ' <description>%s</description>\n' % (tag.find(ns('{}description')).text, ) expected += ' </tag>\n' expected += ' </tags>\n' @@ -261,15 +287,15 @@ def create_tests(tests_dir, tests_file): tests_tree = etree.parse(tests_file).getroot() - fix_cdata_elements = tests_tree.findall('test/input') - fix_cdata_elements += tests_tree.findall('.//description') + fix_cdata_elements = tests_tree.findall(ns('{}test/{}input')) + fix_cdata_elements += tests_tree.findall(ns('.//{}description')) for element in fix_cdata_elements: if element.text: element.text = element.text.replace('{{?', '<!') element.text = element.text.replace('}}', '>') - for counter, test in enumerate(tests_tree.findall('test')): + for counter, test in enumerate(tests_tree.findall(ns('{}test'))): test_name = 'test_%s.%03d' % (tests_name, counter + 1) test_method = TestCommentBlock.__create_test__(test) setattr(TestCommentBlock, test_name, test_method) @@ -290,6 +316,7 @@ if __name__ == '__main__': for filename in filenames: tests_file = os.path.join(dirpath, filename) if os.path.basename(tests_file).endswith('.xml'): + validate(tests_file) create_tests(tests_dir, tests_file) # Run test suite diff --git a/tests/scanner/annotationparser/tests.xsd b/tests/scanner/annotationparser/tests.xsd new file mode 100644 index 00000000..ca47cfe7 --- /dev/null +++ b/tests/scanner/annotationparser/tests.xsd @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="utf-8"?> + +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:t="http://schemas.gnome.org/gobject-introspection/2013/test" + targetNamespace="http://schemas.gnome.org/gobject-introspection/2013/test" + elementFormDefault="qualified" + version="1.0.0"> + + <xs:annotation> + <xs:documentation><![CDATA[ + GObject-Introspection - a framework for introspecting GObject libraries + Copyright © 2013 Dieter Verfaillie <dieterv@optionexplicit.be> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA.]]> + </xs:documentation> + </xs:annotation> + + <xs:simpleType name="PreservedStringtype"> + <xs:restriction base="xs:string"> + <xs:whiteSpace value="preserve"/> + </xs:restriction> + </xs:simpleType> + + <xs:complexType name="OutputType"> + <xs:simpleContent> + <xs:extension base="t:PreservedStringtype"> + <xs:attribute name="indent" type="xs:boolean" default="true" /> + </xs:extension> + </xs:simpleContent> + </xs:complexType> + + <xs:element name="tests"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:test" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="test"> + <xs:complexType> + <xs:sequence> + <xs:element name="input" type="t:PreservedStringtype" /> + <xs:element ref="t:parser" minOccurs="0" /> + <xs:element name="output" minOccurs="0" type="t:OutputType" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="parser"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:docblock" minOccurs="0" /> + <xs:element ref="t:messages" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="docblock"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:identifier" /> + <xs:element ref="t:parameters" minOccurs="0" /> + <xs:element name="description" type="t:PreservedStringtype" minOccurs="0" /> + <xs:element ref="t:tags" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="identifier"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" /> + <xs:element ref="t:annotations" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="tags"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:tag" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="tag"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" /> + <xs:element ref="t:annotations" minOccurs="0" /> + <xs:element name="value" minOccurs="0" /> + <xs:element name="description" type="t:PreservedStringtype" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="parameters"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:parameter" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="parameter"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" /> + <xs:element ref="t:annotations" minOccurs="0" /> + <xs:element name="description" type="t:PreservedStringtype" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="annotations"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:annotation" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="annotation"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" /> + <xs:element ref="t:options" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="options"> + <xs:complexType> + <xs:sequence> + <xs:element ref="t:option" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="option"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" /> + <xs:element name="value" minOccurs="0" /> + </xs:sequence> + </xs:complexType> + </xs:element> + + <xs:element name="messages"> + <xs:complexType> + <xs:sequence> + <xs:element name="message" type="t:PreservedStringtype" maxOccurs="unbounded" /> + </xs:sequence> + </xs:complexType> + </xs:element> + +</xs:schema> |