diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-07-26 13:47:36 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-08 20:54:04 +0200 |
commit | a52dd2c3cf240c8b6b621305b2f80d76eadc7a64 (patch) | |
tree | 81a15d5f623c0b5903732ba53796133d8de5f737 /tests | |
parent | e4907187dd57c1a0e572fd8bd1eb39d07842ef1d (diff) | |
download | gobject-introspection-a52dd2c3cf240c8b6b621305b2f80d76eadc7a64.tar.gz |
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).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/Makefile.am | 6 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/identifier.xml | 94 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/identifier_section.xml (renamed from tests/scanner/annotationparser/gi/syntax_identifier.xml) | 70 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/identifier_symbol.xml | 257 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/parameter.xml | 130 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/syntax.xml | 2 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/tag.xml | 70 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/tag_deprecated.xml | 57 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/tag_returns.xml | 158 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/tag_since.xml | 57 | ||||
-rw-r--r-- | tests/scanner/annotationparser/gi/tag_stability.xml | 57 | ||||
-rw-r--r-- | 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 c0a4b125..e1eb433b 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 00000000..3682ab24 --- /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 index f5453eb8..35ffec65 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 00000000..179b3158 --- /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 00000000..5e3a3a1e --- /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 7838167b..de8f04f3 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 00000000..2dfe41aa --- /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 abb6b4dd..21380143 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 23c29a71..0068679e 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 a2dbb89e..4c586e71 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 31862f03..c434e563 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 dba69711..87b632f4 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 */ -//+ ^ |