[gobject-introspection] tests: move GTK-Doc comment block warning tests
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] tests: move GTK-Doc comment block warning tests
- Date: Wed, 9 Oct 2013 16:55:28 +0000 (UTC)
commit a52dd2c3cf240c8b6b621305b2f80d76eadc7a64
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Fri Jul 26 13:47:36 2013 +0200
tests: move GTK-Doc comment block warning tests
It makes sense to let test_parser.py check everything which
is focused purely on testing GTK-Doc comment blocks
(ie annotationparser.py functionality).
tests/scanner/Makefile.am | 6 +-
tests/scanner/annotationparser/gi/identifier.xml | 94 +++++++
...yntax_identifier.xml => identifier_section.xml} | 70 ------
.../annotationparser/gi/identifier_symbol.xml | 257 ++++++++++++++++++++
tests/scanner/annotationparser/gi/parameter.xml | 130 ++++++++++
tests/scanner/annotationparser/gi/syntax.xml | 2 +
tests/scanner/annotationparser/gi/tag.xml | 70 ++++++
.../scanner/annotationparser/gi/tag_deprecated.xml | 57 +++++
tests/scanner/annotationparser/gi/tag_returns.xml | 158 ++++++++++++-
tests/scanner/annotationparser/gi/tag_since.xml | 57 +++++
.../scanner/annotationparser/gi/tag_stability.xml | 57 +++++
tests/warn/annotationparser.h | 198 ---------------
12 files changed, 884 insertions(+), 272 deletions(-)
---
diff --git a/tests/scanner/Makefile.am b/tests/scanner/Makefile.am
index c0a4b12..e1eb433 100644
--- a/tests/scanner/Makefile.am
+++ b/tests/scanner/Makefile.am
@@ -222,10 +222,14 @@ EXTRA_DIST += \
annotationparser/gi/annotation_unref_func.xml \
annotationparser/gi/annotation_value.xml \
annotationparser/gi/annotation_virtual.xml \
+ annotationparser/gi/identifier.xml \
+ annotationparser/gi/identifier_section.xml \
+ annotationparser/gi/identifier_symbol.xml \
+ annotationparser/gi/parameter.xml \
annotationparser/gi/syntax.xml \
- annotationparser/gi/syntax_identifier.xml \
annotationparser/gi/syntax_nested_tags.xml \
annotationparser/gi/syntax_paragraph_breaks.xml \
+ annotationparser/gi/tag.xml \
annotationparser/gi/tag_deprecated.xml \
annotationparser/gi/tag_description.xml \
annotationparser/gi/tag_returns.xml \
diff --git a/tests/scanner/annotationparser/gi/identifier.xml
b/tests/scanner/annotationparser/gi/identifier.xml
new file mode 100644
index 0000000..3682ab2
--- /dev/null
+++ b/tests/scanner/annotationparser/gi/identifier.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test">
+
+<test>
+ <!--
+ Identifier part not on the first line.
+ -->
+ <input>/**
+ * This is not a valid section identifier
+ * SECTION:test_invalid_section_identifier
+ *
+ * Above identifier is not on the first line.
+ **/</input>
+ <parser>
+ <messages>
+ <message>2: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
+ * This is not a valid section identifier
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Identifier part not on the first line.
+ -->
+ <input>/**
+
+* SECTION:meepapp
+*/</input>
+ <parser>
+ <messages>
+ <message>2: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
+
+^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Multiple identifier parts
+ -->
+ <input>/**
+ * SECTION:meepapp
+ * SECTION:meepapp2
+ * @short_description: the application class
+ *
+ * The application class handles ...
+ */</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>SECTION:meepapp</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>short_description</name>
+ <description>the application class</description>
+ </parameter>
+ </parameters>
+ <description>SECTION:meepapp2
+The application class handles ...</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Invalid identifier
+ -->
+ <input>/**
+ * gnm_cell_set_expr_and_value: Stores (WITHOUT COPYING) the supplied value, and
+ * references the supplied expression and links it into the expression
+ * list. It marks the sheet as dirty. It is intended for use by import
+ * routines or operations that do bulk assignment.
+ *
+ * WARNING : This is an internal routine that does not queue redraws,
+ * does not auto-resize, does not calculate spans, and does
+ * not render the value.
+ *
+ * NOTE : This DOES check for array partitioning.
+ */</input>
+ <parser>
+ <messages>
+ <message>2: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
+ * gnm_cell_set_expr_and_value: Stores (WITHOUT COPYING) the supplied value, and
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+</tests>
diff --git a/tests/scanner/annotationparser/gi/syntax_identifier.xml
b/tests/scanner/annotationparser/gi/identifier_section.xml
similarity index 84%
rename from tests/scanner/annotationparser/gi/syntax_identifier.xml
rename to tests/scanner/annotationparser/gi/identifier_section.xml
index f5453eb..35ffec6 100644
--- a/tests/scanner/annotationparser/gi/syntax_identifier.xml
+++ b/tests/scanner/annotationparser/gi/identifier_section.xml
@@ -4,51 +4,6 @@
<test>
<!--
- Identifier part not on the first line.
- -->
- <input>/**
-*
-* SECTION:meepapp
-*/</input>
- <parser>
- <messages>
- <message>2: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
-*
- ^</message>
- </messages>
- </parser>
-</test>
-
-<test>
- <!--
- Multiple identifier parts
- -->
- <input>/**
- * SECTION:meepapp
- * SECTION:meepapp2
- * @short_description: the application class
- *
- * The application class handles ...
- */</input>
- <parser>
- <docblock>
- <identifier>
- <name>SECTION:meepapp</name>
- </identifier>
- <parameters>
- <parameter>
- <name>short_description</name>
- <description>the application class</description>
- </parameter>
- </parameters>
- <description>SECTION:meepapp2
-The application class handles ...</description>
- </docblock>
- </parser>
-</test>
-
-<test>
- <!--
Section documentation including all optional metadata.
-->
<input>/**
@@ -371,29 +326,4 @@ returns nothing.</description>
</parser>
</test>
-<test>
- <!--
- Invalid identifier
- -->
- <input>/**
- * gnm_cell_set_expr_and_value: Stores (WITHOUT COPYING) the supplied value, and
- * references the supplied expression and links it into the expression
- * list. It marks the sheet as dirty. It is intended for use by import
- * routines or operations that do bulk assignment.
- *
- * WARNING : This is an internal routine that does not queue redraws,
- * does not auto-resize, does not calculate spans, and does
- * not render the value.
- *
- * NOTE : This DOES check for array partitioning.
- */</input>
- <parser>
- <messages>
- <message>2: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
- * gnm_cell_set_expr_and_value: Stores (WITHOUT COPYING) the supplied value, and
- ^</message>
- </messages>
- </parser>
-</test>
-
</tests>
diff --git a/tests/scanner/annotationparser/gi/identifier_symbol.xml
b/tests/scanner/annotationparser/gi/identifier_symbol.xml
new file mode 100644
index 0000000..179b315
--- /dev/null
+++ b/tests/scanner/annotationparser/gi/identifier_symbol.xml
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test">
+
+<test>
+ <input>/**
+ * test_symbol
+ *
+ * test_symbol does something nifty.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_symbol</name>
+ </identifier>
+ <description>test_symbol does something nifty.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 15:
+ * test_symbol
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_symbol_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_symbol_unnecessary_colon</name>
+ </identifier>
+ <description>Unnecessary colon.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_annotated_symbol: (skip)
+ *
+ * test_annotated_symbol does something nifty.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_annotated_symbol</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>test_annotated_symbol does something nifty.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_symbol_missing_colon (skip)
+ *
+ * Missing colon will result in a warning.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_symbol_missing_colon</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>Missing colon will result in a warning.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 30:
+ * test_symbol_missing_colon (skip)
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget:test_property
+ *
+ * Some property.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget:test_property</name>
+ </identifier>
+ <description>Some property.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 27:
+ * GtkWidget:test_property
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget:test_property_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget:test_property_unnecessary_colon</name>
+ </identifier>
+ <description>Unnecessary colon.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget:test_annotated_property: (skip)
+ *
+ * Some annotated property.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget:test_annotated_property</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>Some annotated property.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget:test_property_missing_colon (skip)
+ *
+ * Missing colon will result in a warning.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget:test_property_missing_colon</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>Missing colon will result in a warning.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 42:
+ * GtkWidget:test_property_missing_colon (skip)
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget::test_signal
+ *
+ * Some signal.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget::test_signal</name>
+ </identifier>
+ <description>Some signal.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 26:
+ * GtkWidget::test_signal
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget::test_signal_unnecessary_colon:
+ *
+ * Unnecessary colon.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget::test_signal_unnecessary_colon</name>
+ </identifier>
+ <description>Unnecessary colon.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget::test_annotated_signal: (skip)
+ *
+ * Some annotated signal.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget::test_annotated_signal</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>Some annotated signal.</description>
+ </docblock>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * GtkWidget::test_signal_missing_colon (skip)
+ *
+ * Missing colon will result in a warning.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>GtkWidget::test_signal_missing_colon</name>
+ <annotations>
+ <annotation>
+ <name>skip</name>
+ </annotation>
+ </annotations>
+ </identifier>
+ <description>Missing colon will result in a warning.</description>
+ </docblock>
+ <messages>
+ <message>2: Warning: Test: missing ':' at column 41:
+ * GtkWidget::test_signal_missing_colon (skip)
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+</tests>
diff --git a/tests/scanner/annotationparser/gi/parameter.xml b/tests/scanner/annotationparser/gi/parameter.xml
new file mode 100644
index 0000000..5e3a3a1
--- /dev/null
+++ b/tests/scanner/annotationparser/gi/parameter.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test">
+
+<test>
+ <input>/**
+ * test_unexpected_parameter:
+ *
+ * Parameters should go before the comment block description.
+ *
+ * @param1: first parameter
+ * Returns: something
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_unexpected_parameter</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>param1</name>
+ <description>first parameter</description>
+ </parameter>
+ </parameters>
+ <description>Parameters should go before the comment block description.</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <description>something</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>6: Warning: Test: '@param1' parameter unexpected at this location:
+ * @param1: first parameter
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_multiple_parameters:
+ * @param1: first parameter
+ * @param1: first parameter again
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_parameters</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>param1</name>
+ <description>first parameter again</description>
+ </parameter>
+ </parameters>
+ </docblock>
+ <messages>
+ <message>4: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
+ * @param1: first parameter again
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_multiline_annotations_on_parameter:
+ * @param1: (allow-none)
+ * (transfer full): first parameter
+ *
+ * Annotations spanning multiple lines are not valid
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiline_annotations_on_parameter</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>param1</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
+ <description>(transfer full): first parameter</description>
+ </parameter>
+ </parameters>
+ <description>Annotations spanning multiple lines are not valid</description>
+ </docblock>
+ <messages>
+ <message>4: Warning: Test: ignoring invalid multiline annotation continuation:
+ * (transfer full): first parameter
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_multiline_annotations_on_parameter:
+ * @param1: (allow-none): first parameter having a second line which looks
+ * (like an annotation), but isn't. This should not result in a warning.
+ *
+ * Annotations spanning multiple lines are not valid
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiline_annotations_on_parameter</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>param1</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
+ <description>first parameter having a second line which looks (like an annotation), but isn't.
This should not result in a warning.</description>
+ </parameter>
+ </parameters>
+ <description>Annotations spanning multiple lines are not valid</description>
+ </docblock>
+ </parser>
+</test>
+
+</tests>
diff --git a/tests/scanner/annotationparser/gi/syntax.xml b/tests/scanner/annotationparser/gi/syntax.xml
index 7838167..de8f04f 100644
--- a/tests/scanner/annotationparser/gi/syntax.xml
+++ b/tests/scanner/annotationparser/gi/syntax.xml
@@ -80,6 +80,7 @@ something */</input>
<test>
<!--
Technically not GTK-Doc, but we need to support this for backwards compatibility
+ with the old annotationparser.
-->
<input>/**
Test
@@ -105,6 +106,7 @@ Test
<test>
<!--
Technically not GTK-Doc, but we need to support this for backwards compatibility
+ with the old annotationparser.
-->
<input>/**
Test
diff --git a/tests/scanner/annotationparser/gi/tag.xml b/tests/scanner/annotationparser/gi/tag.xml
new file mode 100644
index 0000000..2dfe41a
--- /dev/null
+++ b/tests/scanner/annotationparser/gi/tag.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test">
+
+<test>
+ <input>/**
+ * test_multiline_annotations_on_tag:
+ *
+ * Annotations spanning multiple lines are not valid
+ *
+ * Returns: (allow-none)
+ * (transfer full): something
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiline_annotations_on_tag</name>
+ </identifier>
+ <description>Annotations spanning multiple lines are not valid</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
+ <description>(transfer full): something</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>7: Warning: Test: ignoring invalid multiline annotation continuation:
+ * (transfer full): something
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <input>/**
+ * test_multiline_annotations_on_tag:
+ *
+ * Annotations spanning multiple lines are not valid
+ *
+ * Returns: (allow-none): Returns tag having a second line which looks
+ * (like an annotation), but isn't. This should not result in a warning.
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiline_annotations_on_tag</name>
+ </identifier>
+ <description>Annotations spanning multiple lines are not valid</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
+ <description>Returns tag having a second line which looks (like an annotation), but isn't. This
should not result in a warning.</description>
+ </tag>
+ </tags>
+ </docblock>
+ </parser>
+</test>
+
+</tests>
diff --git a/tests/scanner/annotationparser/gi/tag_deprecated.xml
b/tests/scanner/annotationparser/gi/tag_deprecated.xml
index abb6b4d..2138014 100644
--- a/tests/scanner/annotationparser/gi/tag_deprecated.xml
+++ b/tests/scanner/annotationparser/gi/tag_deprecated.xml
@@ -44,4 +44,61 @@
</parser>
</test>
+<test>
+ <input>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Deprecated: (allow-none): 2.24
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_tag_not_annotatable</name>
+ </identifier>
+ <description>Tags (except Returns:) don't have annotations</description>
+ <tags>
+ <tag>
+ <name>deprecated</name>
+ <description>2.24</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>6: Warning: Test: annotations not supported for tag 'Deprecated:'.</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Multiple "Deprecated:" tags
+ -->
+ <input>/**
+ * test_multiple_tags:
+ *
+ * Deprecated: 3.0
+ * Deprecated: 2.0
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_tags</name>
+ </identifier>
+ <tags>
+ <tag>
+ <name>deprecated</name>
+ <description>2.0</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>5: Warning: Test: multiple 'Deprecated:' tags for identifier 'test_multiple_tags':
+ * Deprecated: 2.0
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
</tests>
diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml
b/tests/scanner/annotationparser/gi/tag_returns.xml
index 23c29a7..0068679 100644
--- a/tests/scanner/annotationparser/gi/tag_returns.xml
+++ b/tests/scanner/annotationparser/gi/tag_returns.xml
@@ -8,7 +8,7 @@
*
* Test returning a string as an out parameter
*
- * Returns: some boolean
+ * Returns: (allow-none): some boolean
**/</input>
<parser>
<docblock>
@@ -19,6 +19,11 @@
<tags>
<tag>
<name>returns</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
<description>some boolean</description>
</tag>
</tags>
@@ -27,6 +32,41 @@
</test>
<test>
+ <input>/**
+ * test_unexpected_tag:
+ * @param1: first parameter
+ * Returns: something
+ *
+ * Tags should go after the comment block description
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_unexpected_tag</name>
+ </identifier>
+ <parameters>
+ <parameter>
+ <name>param1</name>
+ <description>first parameter</description>
+ </parameter>
+ </parameters>
+ <description>Tags should go after the comment block description</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <description>something</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>4: Warning: Test: 'Returns:' tag unexpected at this location:
+ * Returns: something
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
<!--
Deprecated "Return value:" tag
-->
@@ -35,7 +75,7 @@
*
* Test returning a string as an out parameter
*
- * Return value: some boolean
+ * Return value: (allow-none): some boolean
**/</input>
<parser>
<docblock>
@@ -46,6 +86,11 @@
<tags>
<tag>
<name>returns</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
<description>some boolean</description>
</tag>
</tags>
@@ -59,7 +104,7 @@
-->
<input>/**
* annotation_object_string_out:
- * @returns: some boolean
+ * @returns: (allow-none): some boolean
*
* Test returning a string as an out parameter
**/</input>
@@ -72,6 +117,11 @@
<tags>
<tag>
<name>returns</name>
+ <annotations>
+ <annotation>
+ <name>allow-none</name>
+ </annotation>
+ </annotations>
<description>some boolean</description>
</tag>
</tags>
@@ -79,4 +129,106 @@
</parser>
</test>
+<test>
+ <!--
+ Variation of multiple "Returns:" notations
+ -->
+ <input>/**
+ * test_multiple_returns_tag_and_parameter:
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Return Value: something
+ * @returns: something else
+ */</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_returns_tag_and_parameter</name>
+ </identifier>
+ <description>Multiple return value warnings are checked for when a returns
+parameter is encountered.</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <description>something else</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>8: Warning: Test: '@returns' parameter unexpected at this location:
+ * @returns: something else
+ ^</message>
+ <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag_and_parameter'.</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Variation of multiple "Returns:" notations
+ -->
+ <input>/**
+ * test_multiple_returns_tag_and_parameter:
+ * @returns: something
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Return Value: something else
+ */</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_returns_tag_and_parameter</name>
+ </identifier>
+ <description>Multiple return value warnings are checked for when a returns
+parameter is encountered.</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <description>something else</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag_and_parameter'.</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Variation of multiple "Returns:" notations
+ -->
+ <input>/**
+ * test_multiple_returns_tag_and_parameter:
+ * @returns: something
+ *
+ * Multiple return value warnings are checked for when a returns
+ * parameter is encountered.
+ *
+ * Returns: something else
+ */</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_returns_tag_and_parameter</name>
+ </identifier>
+ <description>Multiple return value warnings are checked for when a returns
+parameter is encountered.</description>
+ <tags>
+ <tag>
+ <name>returns</name>
+ <description>something else</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>8: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag_and_parameter'.</message>
+ </messages>
+ </parser>
+</test>
+
</tests>
diff --git a/tests/scanner/annotationparser/gi/tag_since.xml b/tests/scanner/annotationparser/gi/tag_since.xml
index a2dbb89..4c586e7 100644
--- a/tests/scanner/annotationparser/gi/tag_since.xml
+++ b/tests/scanner/annotationparser/gi/tag_since.xml
@@ -44,4 +44,61 @@
</parser>
</test>
+<test>
+ <input>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Since: (allow-none): 2.24
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_tag_not_annotatable</name>
+ </identifier>
+ <description>Tags (except Returns:) don't have annotations</description>
+ <tags>
+ <tag>
+ <name>since</name>
+ <description>2.24</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>6: Warning: Test: annotations not supported for tag 'Since:'.</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Multiple "Since:" tags
+ -->
+ <input>/**
+ * test_multiple_tags:
+ *
+ * Since: 3.0
+ * Since: 2.0
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_tags</name>
+ </identifier>
+ <tags>
+ <tag>
+ <name>since</name>
+ <description>2.0</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>5: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
+ * Since: 2.0
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
</tests>
diff --git a/tests/scanner/annotationparser/gi/tag_stability.xml
b/tests/scanner/annotationparser/gi/tag_stability.xml
index 31862f0..c434e56 100644
--- a/tests/scanner/annotationparser/gi/tag_stability.xml
+++ b/tests/scanner/annotationparser/gi/tag_stability.xml
@@ -86,4 +86,61 @@
</parser>
</test>
+<test>
+ <input>/**
+ * test_tag_not_annotatable:
+ *
+ * Tags (except Returns:) don't have annotations
+ *
+ * Stability: (allow-none): Private
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_tag_not_annotatable</name>
+ </identifier>
+ <description>Tags (except Returns:) don't have annotations</description>
+ <tags>
+ <tag>
+ <name>stability</name>
+ <description>Private</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>6: Warning: Test: annotations not supported for tag 'Stability:'.</message>
+ </messages>
+ </parser>
+</test>
+
+<test>
+ <!--
+ Multiple "Stability:" tags
+ -->
+ <input>/**
+ * test_multiple_tags:
+ *
+ * Stability: Public
+ * Stability: Private
+ **/</input>
+ <parser>
+ <docblock>
+ <identifier>
+ <name>test_multiple_tags</name>
+ </identifier>
+ <tags>
+ <tag>
+ <name>stability</name>
+ <description>Private</description>
+ </tag>
+ </tags>
+ </docblock>
+ <messages>
+ <message>5: Warning: Test: multiple 'Stability:' tags for identifier 'test_multiple_tags':
+ * Stability: Private
+ ^</message>
+ </messages>
+ </parser>
+</test>
+
</tests>
diff --git a/tests/warn/annotationparser.h b/tests/warn/annotationparser.h
index dba6971..87b632f 100644
--- a/tests/warn/annotationparser.h
+++ b/tests/warn/annotationparser.h
@@ -16,201 +16,3 @@ void test_symbol_twice_documented();
**/
// EXPECT:12: Warning: Test: multiple comment blocks documenting 'test_symbol_twice_documented:' identifier.
-
-
-/**
- * test_symbol_missing_colon
- *
- * Forgotten colon above will result in a warning.
- **/
-
-// EXPECT:22: Warning: Test: missing ':' at column 29:
-//+ * test_symbol_missing_colon
-//+ ^
-
-
-/**
- * GtkWidget:test_property_missing_colon
- *
- * Forgotten colon above will result in a warning.
- **/
-
-// EXPECT:33: Warning: Test: missing ':' at column 41:
-//+ * GtkWidget:test_property_missing_colon
-//+ ^
-
-
-/**
- * GtkWidget::test_signal_missing_colon
- *
- * Forgotten colon above will result in a warning.
- **/
-
-// EXPECT:44: Warning: Test: missing ':' at column 40:
-//+ * GtkWidget::test_signal_missing_colon
-//+ ^
-
-
-/**
- * This is not a valid section identifier
- * SECTION:test_invalid_section_idetifier
- *
- * Above identifier will result in a warning.
- **/
-
-// EXPECT:55: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
-//+ * This is not a valid section identifier
-//+ ^
-
-
-/**
- * test_unexpected_parameter:
- * @param1: first parameter
- *
- * Parameters should come before the comment block description
- *
- * Returns: something
- * @param2: second parameter
- **/
-
-// EXPECT:73: Warning: Test: '@param2' parameter unexpected at this location:
-//+ * @param2: second parameter
-//+ ^
-
-
-/**
- * test_multiple_returns_tag_and_parameter:
- *
- * Multiple return value warnings are checked for when a returns
- * parameter is encountered.
- *
- * Return Value: something
- * @returns: something
- */
-
-// EXPECT:88: Warning: Test: '@returns' parameter unexpected at this location:
-//+ * @returns: something
-//+ ^
-// EXPECT:88: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag_and_parameter'.
-
-
-/**
- * test_multiple_parameters:
- * @param1: first parameter
- * @param1: first parameter
- **/
-
-// EXPECT:100: Warning: Test: multiple '@param1' parameters for identifier 'test_multiple_parameters':
-//+ * @param1: first parameter
-//+ ^
-
-
-/**
- * test_unexpected_tag:
- * @param1: first parameter
- * Returns: something
- *
- * Tags should go after the comment block description
- **/
-
-// EXPECT:111: Warning: Test: 'Returns:' tag unexpected at this location:
-//+ * Returns: something
-//+ ^
-
-
-/**
- * test_multiple_returns_tag:
- * @returns: something
- *
- * Multiple return value warnings are checked for when returns tag is used
- *
- * Returns: anything
- * Return value: whatever
- **/
-
-// EXPECT:127: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag'.
-// EXPECT:128: Warning: Test: encountered multiple 'Returns' parameters or tags for
'test_multiple_returns_tag'.
-
-
-/**
- * test_multiple_tags:
- *
- * Since: 3.0
- * Since: 3.0
- **/
-
-// EXPECT:139: Warning: Test: multiple 'Since:' tags for identifier 'test_multiple_tags':
-//+ * Since: 3.0
-//+ ^
-
-
-/**
- * test_tag_annotatable:
- *
- * There's currently 2 tags that can be annotated, so these don't emit warnings
- *
- * Returns: (allow-none): something
- * Attributes: (free) (form) (annotations)
- **/
-
-/**
- * test_tag_not_annotatable:
- *
- * Tags (except Returns: and Attributes:) don't have annotations
- *
- * Since: (allow-none): 2.24
- **/
-
-// EXPECT:161: Warning: Test: annotations not supported for tag 'Since:'.
-
-
-/**
- * test_multiline_annotations_on_parameter:
- * @param1: (allow-none)
- * (transfer full): first parameter
- *
- * Annotations spanning multiple lines are not valid
- **/
-
-// EXPECT:170: Warning: Test: ignoring invalid multiline annotation continuation:
-//+ * (transfer full): first parameter
-//+ ^
-
-
-/**
- * test_multiline_annotations_on_tag:
- *
- * Annotations spanning multiple lines are not valid
- *
- * Returns: (allow-none)
- * (transfer full): something
- **/
-
-// EXPECT:186: Warning: Test: ignoring invalid multiline annotation continuation:
-//+ * (transfer full): something
-//+ ^
-
-
-/**
-
- * regress_test_invalid_comment:
- * @foo: a param
- *
- * invalid comment with a line without
- * https://bugzilla.gnome.org/show_bug.cgi?id=673806
- */
-
-// EXPECT:195: Warning: Test: ignoring unrecognized GTK-Doc comment block, identifier not found:
-//+
-//+^
-
-/**
- * regress_test_invalid_comment_end:
- * @foo: a param
- *
- * invalid comment with a line without
- * https://bugzilla.gnome.org/show_bug.cgi?id=689354 */
-
-// EXPECT:212: Warning: Test: Comments should end with */ on a new line:
-//+ * https://bugzilla.gnome.org/show_bug.cgi?id=689354 */
-//+ ^
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]