diff options
Diffstat (limited to 'tests/scanner/annotationparser/gi')
41 files changed, 8989 insertions, 0 deletions
diff --git a/tests/scanner/annotationparser/gi/annotation_allow_none.xml b/tests/scanner/annotationparser/gi/annotation_allow_none.xml new file mode 100644 index 00000000..ae6b3b37 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_allow_none.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_inout: + * @object: a #GObject + * @inoutarg: (inout) (allow-none): This is an argument test + * + * This is a test for out arguments + * + * Return value: (allow-none): an int + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_inout</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #GObject</description> + </parameter> + <parameter> + <name>inoutarg</name> + <annotations> + <annotation> + <name>inout</name> + </annotation> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + </parameters> + <description>This is a test for out arguments</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>an int</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_inout: + * @object: a #GObject + * @inoutarg: (inout) (allow-none): This is an argument test + * + * This is a test for out arguments + * + * Returns: (allow-none): an int + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml new file mode 100644 index 00000000..3a7cbc0b --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -0,0 +1,483 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_compute_sum: + * @nums: (array): Sequence of numbers + * + * Test taking a zero-terminated array + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_compute_sum</name> + </identifier> + <parameters> + <parameter> + <name>nums</name> + <annotations> + <annotation> + <name>array</name> + </annotation> + </annotations> + <description>Sequence of numbers</description> + </parameter> + </parameters> + <description>Test taking a zero-terminated array</description> + </docblock> + </parser> + <output>/** + * annotation_object_compute_sum: + * @nums: (array): Sequence of numbers + * + * Test taking a zero-terminated array + */</output> +</test> + +<test> + <input>/** + * annotation_object_compute_sum_n: + * @object: a #AnnotationObject + * @nums: (array length=n_nums zero-terminated=0): Sequence of + * numbers that are zero-terminated + * @n_nums: Length of number array + * + * Test taking an array with length parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_compute_sum_n</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #AnnotationObject</description> + </parameter> + <parameter> + <name>nums</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>length</name> + <value>n_nums</value> + </option> + <option> + <name>zero-terminated</name> + <value>0</value> + </option> + </options> + </annotation> + </annotations> + <description>Sequence of + numbers that are zero-terminated</description> + </parameter> + <parameter> + <name>n_nums</name> + <description>Length of number array</description> + </parameter> + </parameters> + <description>Test taking an array with length parameter</description> + </docblock> + </parser> + <output>/** + * annotation_object_compute_sum_n: + * @object: a #AnnotationObject + * @nums: (array length=n_nums zero-terminated=0): Sequence of + * numbers that are zero-terminated + * @n_nums: Length of number array + * + * Test taking an array with length parameter + */</output> +</test> + +<test> + <input>/** + * annotation_object_compute_sum_nz: + * @object: a #AnnotationObject + * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers that + * are zero-terminated + * @n_nums: Length of number array + * + * Test taking a zero-terminated array with length parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_compute_sum_nz</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #AnnotationObject</description> + </parameter> + <parameter> + <name>nums</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>length</name> + <value>n_nums</value> + </option> + <option> + <name>zero-terminated</name> + <value>1</value> + </option> + </options> + </annotation> + </annotations> + <description>Sequence of numbers that +are zero-terminated</description> + </parameter> + <parameter> + <name>n_nums</name> + <description>Length of number array</description> + </parameter> + </parameters> + <description>Test taking a zero-terminated array with length parameter</description> + </docblock> + </parser> + <output>/** + * annotation_object_compute_sum_nz: + * @object: a #AnnotationObject + * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers that + * are zero-terminated + * @n_nums: Length of number array + * + * Test taking a zero-terminated array with length parameter + */</output> +</test> + +<test> + <input>/** + * annotation_object_parse_args: + * @object: a #AnnotationObject + * @argc: (inout): Length of the argument vector + * @argv: (inout) (array length=argc zero-terminated=1): Argument vector + * + * Test taking a zero-terminated array with length parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_parse_args</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #AnnotationObject</description> + </parameter> + <parameter> + <name>argc</name> + <annotations> + <annotation> + <name>inout</name> + </annotation> + </annotations> + <description>Length of the argument vector</description> + </parameter> + <parameter> + <name>argv</name> + <annotations> + <annotation> + <name>inout</name> + </annotation> + <annotation> + <name>array</name> + <options> + <option> + <name>length</name> + <value>argc</value> + </option> + <option> + <name>zero-terminated</name> + <value>1</value> + </option> + </options> + </annotation> + </annotations> + <description>Argument vector</description> + </parameter> + </parameters> + <description>Test taking a zero-terminated array with length parameter</description> + </docblock> + </parser> + <output>/** + * annotation_object_parse_args: + * @object: a #AnnotationObject + * @argc: (inout): Length of the argument vector + * @argv: (inout) (array length=argc zero-terminated=1): Argument vector + * + * Test taking a zero-terminated array with length parameter + */</output> +</test> + +<test> + <input>/** + * annotation_object_set_data: + * @object: a #AnnotationObject + * @data: (array length=length): The data + * @length: Length of the data + * + * Test taking a guchar * with a length. + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_set_data</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #AnnotationObject</description> + </parameter> + <parameter> + <name>data</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>length</name> + <value>length</value> + </option> + </options> + </annotation> + </annotations> + <description>The data</description> + </parameter> + <parameter> + <name>length</name> + <description>Length of the data</description> + </parameter> + </parameters> + <description>Test taking a guchar * with a length.</description> + </docblock> + </parser> + <output>/** + * annotation_object_set_data: + * @object: a #AnnotationObject + * @data: (array length=length): The data + * @length: Length of the data + * + * Test taking a guchar * with a length. + */</output> +</test> + +<test> + <input>/** + * annotation_string_zero_terminated: + * @data: (array fixed-size=2): a third value + * + * Return value: (transfer full) (array zero-terminated=1): The return value + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_string_zero_terminated</name> + </identifier> + <parameters> + <parameter> + <name>data</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>fixed-size</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + <description>a third value</description> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + <annotation> + <name>array</name> + <options> + <option> + <name>zero-terminated</name> + <value>1</value> + </option> + </options> + </annotation> + </annotations> + <description>The return value</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_string_zero_terminated: + * @data: (array fixed-size=2): a third value + * + * Returns: (transfer full) (array zero-terminated=1): The return value + */</output> +</test> + +<test> + <input>/** + * annotation_string_zero_terminated: + * @data: (array invalid fixed-size=2): a third value + * + * Return value: (transfer full) (array zero-terminated=1): The return value + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_string_zero_terminated</name> + </identifier> + <parameters> + <parameter> + <name>data</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>invalid</name> + </option> + <option> + <name>fixed-size</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + <description>a third value</description> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + <annotation> + <name>array</name> + <options> + <option> + <name>zero-terminated</name> + <value>1</value> + </option> + </options> + </annotation> + </annotations> + <description>The return value</description> + </tag> + </tags> + </docblock> + <messages> + <message>3: Warning: Test: invalid "array" annotation option: "invalid"</message> + </messages> + </parser> + <output>/** + * annotation_string_zero_terminated: + * @data: (array invalid fixed-size=2): a third value + * + * Returns: (transfer full) (array zero-terminated=1): The return value + */</output> +</test> + +<test> + <input>/** + * g_app_launch_context_get_environment: + * @arg1: (array zero-terminated): ... + * @arg2: (array length): ... + * + * Returns: (array zero-terminated=yes): the child's environment + */</input> + <parser> + <docblock> + <identifier> + <name>g_app_launch_context_get_environment</name> + </identifier> + <parameters> + <parameter> + <name>arg1</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>zero-terminated</name> + </option> + </options> + </annotation> + </annotations> + <description>...</description> + </parameter> + <parameter> + <name>arg2</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>length</name> + </option> + </options> + </annotation> + </annotations> + <description>...</description> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>zero-terminated</name> + <value>yes</value> + </option> + </options> + </annotation> + </annotations> + <description>the child's environment</description> + </tag> + </tags> + </docblock> + <messages> + <message>3: Warning: Test: "array" annotation option "zero-terminated" needs a value</message> + <message>4: Warning: Test: "array" annotation option "length" needs a value</message> + <message>6: Warning: Test: invalid "array" annotation option "zero-terminated" value "yes", must be an integer</message> + </messages> + </parser> + <output>/** + * g_app_launch_context_get_environment: + * @arg1: (array zero-terminated): ... + * @arg2: (array length): ... + * + * Returns: (array zero-terminated=yes): the child's environment + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_attributes.xml b/tests/scanner/annotationparser/gi/annotation_attributes.xml new file mode 100644 index 00000000..e9d9b429 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_attributes.xml @@ -0,0 +1,477 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * AnnotationObject: (attributes org.example.test1=horses org.example.test2 org.example.test3=cows) + * + * This is an object used to test annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>org.example.test1</name> + <value>horses</value> + </option> + <option> + <name>org.example.test2</name> + </option> + <option> + <name>org.example.test3</name> + <value>cows</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + </parser> + <output>/** + * AnnotationObject: (attributes org.example.test1=horses org.example.test2 org.example.test3=cows) + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <!-- + Deprecated "Attributes:" tag + --> + <input>/** + * AnnotationObject: + * + * This is an object used to test annotations. + * + * Attributes: (org.example.test1 horses) (org.example.test2) (org.example.test3 cows) + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>org.example.test1</name> + <value>horses</value> + </option> + <option> + <name>org.example.test2</name> + </option> + <option> + <name>org.example.test3</name> + <value>cows</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Attributes" has been deprecated, please use annotations on the identifier instead: + * Attributes: (org.example.test1 horses) (org.example.test2) (org.example.test3 cows) + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject: (attributes org.example.test1=horses org.example.test2 org.example.test3=cows) + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <!-- + Variation of "Attributes:" tag + --> + <input>/** + * AnnotationObject: + * + * This is an object used to test annotations. + * + * Attributes: (org.example.test1 horses)) + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Attributes" has been deprecated, please use annotations on the identifier instead: + * Attributes: (org.example.test1 horses)) + ^</message> + <message>6: Error: Test: unbalanced parentheses, annotations will be ignored: +Attributes: (org.example.test1 horses)) + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject: + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <!-- + (attributes) annotation on the identifier together with a + deprecated "Attributes:" tag. + --> + <input>/** + * AnnotationObject: (attributes org.example.test1=horses) + * + * This is an object used to test annotations. + * + * Attributes: (org.example.test1 horses) (org.example.test2 cows) + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>org.example.test1</name> + <value>horses</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Attributes" has been deprecated, please use annotations on the identifier instead: + * Attributes: (org.example.test1 horses) (org.example.test2 cows) + ^</message> + <message>6: Error: Test: Duplicate "Attributes:" annotation will be ignored: + * Attributes: (org.example.test1 horses) (org.example.test2 cows) + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject: (attributes org.example.test1=horses) + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <!-- + Deprecated "Attributes:" tag in the wrong location + --> + <input>/** + * AnnotationObject: + * + * Attributes: (org.example.Test horses) (org.example.test2 cows) + * + * This is an object used to test annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>org.example.Test</name> + <value>horses</value> + </option> + <option> + <name>org.example.test2</name> + <value>cows</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Attributes" has been deprecated, please use annotations on the identifier instead: + * Attributes: (org.example.Test horses) (org.example.test2 cows) + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject: (attributes org.example.Test=horses org.example.test2=cows) + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <input>/** + * AnnotationObject: + * + * Attributes: (org.example.Test horses cows) + * + * This is an object used to test annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject</name> + </identifier> + <description>This is an object used to test annotations.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Attributes" has been deprecated, please use annotations on the identifier instead: + * Attributes: (org.example.Test horses cows) + ^</message> + <message>4: Error: Test: malformed "Attributes:" tag will be ignored: + * Attributes: (org.example.Test horses cows) + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject: + * + * This is an object used to test annotations. + */</output> +</test> + +<test> + <input>/** + * AnnotationObject::attribute-signal: + * @annotation: the annotation object + * @arg1: (attributes some.annotation.foo1=val1): a value + * @arg2: (attributes some.annotation.foo2=val2): another value + * @arg3: (array fixed-size=2): a third value + * + * This signal tests a signal with attributes. + * + * Returns: (attributes some.annotation.foo3=val3): the return value + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject::attribute-signal</name> + </identifier> + <parameters> + <parameter> + <name>annotation</name> + <description>the annotation object</description> + </parameter> + <parameter> + <name>arg1</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo1</name> + <value>val1</value> + </option> + </options> + </annotation> + </annotations> + <description>a value</description> + </parameter> + <parameter> + <name>arg2</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo2</name> + <value>val2</value> + </option> + </options> + </annotation> + </annotations> + <description>another value</description> + </parameter> + <parameter> + <name>arg3</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>fixed-size</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + <description>a third value</description> + </parameter> + </parameters> + <description>This signal tests a signal with attributes.</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo3</name> + <value>val3</value> + </option> + </options> + </annotation> + </annotations> + <description>the return value</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * AnnotationObject::attribute-signal: + * @annotation: the annotation object + * @arg1: (attributes some.annotation.foo1=val1): a value + * @arg2: (attributes some.annotation.foo2=val2): another value + * @arg3: (array fixed-size=2): a third value + * + * This signal tests a signal with attributes. + * + * Returns: (attributes some.annotation.foo3=val3): the return value + */</output> +</test> + +<test> + <!-- + Deprecated (attribute) annotation. + --> + <input>/** + * AnnotationObject::attribute-signal: + * @annotation: the annotation object + * @arg1: (attribute some.annotation.foo1): a value + * @arg2: (attribute some.annotation.foo2 val2): another value + * @arg3: (attribute x y z): something special + * @arg4: (array fixed-size=2): a third value + * + * This signal tests a signal with attributes. + * + * Returns: (attribute some.annotation.foo3 val3): the return value + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject::attribute-signal</name> + </identifier> + <parameters> + <parameter> + <name>annotation</name> + <description>the annotation object</description> + </parameter> + <parameter> + <name>arg1</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo1</name> + </option> + </options> + </annotation> + </annotations> + <description>a value</description> + </parameter> + <parameter> + <name>arg2</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo2</name> + <value>val2</value> + </option> + </options> + </annotation> + </annotations> + <description>another value</description> + </parameter> + <parameter> + <name>arg3</name> + <description>something special</description> + </parameter> + <parameter> + <name>arg4</name> + <annotations> + <annotation> + <name>array</name> + <options> + <option> + <name>fixed-size</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + <description>a third value</description> + </parameter> + </parameters> + <description>This signal tests a signal with attributes.</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>attributes</name> + <options> + <option> + <name>some.annotation.foo3</name> + <value>val3</value> + </option> + </options> + </annotation> + </annotations> + <description>the return value</description> + </tag> + </tags> + </docblock> + <messages> + <message>4: Warning: Test: "attribute" annotation has been deprecated, please use "attributes" instead: + * @arg1: (attribute some.annotation.foo1): a value + ^</message> + <message>5: Warning: Test: "attribute" annotation has been deprecated, please use "attributes" instead: + * @arg2: (attribute some.annotation.foo2 val2): another value + ^</message> + <message>6: Warning: Test: "attribute" annotation has been deprecated, please use "attributes" instead: + * @arg3: (attribute x y z): something special + ^</message> + <message>6: Error: Test: malformed "(attribute)" annotation will be ignored: + * @arg3: (attribute x y z): something special + ^</message> + <message>11: Warning: Test: "attribute" annotation has been deprecated, please use "attributes" instead: + * Returns: (attribute some.annotation.foo3 val3): the return value + ^</message> + </messages> + </parser> + <output>/** + * AnnotationObject::attribute-signal: + * @annotation: the annotation object + * @arg1: (attributes some.annotation.foo1): a value + * @arg2: (attributes some.annotation.foo2=val2): another value + * @arg3: something special + * @arg4: (array fixed-size=2): a third value + * + * This signal tests a signal with attributes. + * + * Returns: (attributes some.annotation.foo3=val3): the return value + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_closure.xml b/tests/scanner/annotationparser/gi/annotation_closure.xml new file mode 100644 index 00000000..f67862c5 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_closure.xml @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * AnnotationNotifyFunc: + * @data: (closure): The user data + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationNotifyFunc</name> + </identifier> + <parameters> + <parameter> + <name>data</name> + <annotations> + <annotation> + <name>closure</name> + </annotation> + </annotations> + <description>The user data</description> + </parameter> + </parameters> + <description>This is a callback with a 'closure' argument that is not named +'user_data' and hence has to be annotated.</description> + </docblock> + </parser> + <output>/** + * AnnotationNotifyFunc: + * @data: (closure): The user data + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + */</output> +</test> + +<test> + <input>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_custom_destroy</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>destroy</name> + <options> + <option> + <name>destroy</name> + </option> + </options> + </annotation> + <annotation> + <name>closure</name> + <options> + <option> + <name>data</name> + </option> + </options> + </annotation> + </annotations> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test messing up the heuristic of closure/destroy-notification +detection, and fixing it via annotations.</description> + </docblock> + </parser> + <output>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</output> +</test> + +<test> + <input>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data=invalid): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_custom_destroy</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>destroy</name> + <options> + <option> + <name>destroy</name> + </option> + </options> + </annotation> + <annotation> + <name>closure</name> + <options> + <option> + <name>data=invalid</name> + </option> + </options> + </annotation> + </annotations> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test messing up the heuristic of closure/destroy-notification +detection, and fixing it via annotations.</description> + </docblock> + <messages> + <message>3: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * @callback: (destroy destroy) (closure data=invalid): Destroy notification + ^</message> + </messages> + </parser> + <output>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data=invalid): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_constructor.xml b/tests/scanner/annotationparser/gi/annotation_constructor.xml new file mode 100644 index 00000000..8c0aeb28 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_constructor.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * regress_constructor: (constructor) + */</input> + <parser> + <docblock> + <identifier> + <name>regress_constructor</name> + <annotations> + <annotation> + <name>constructor</name> + </annotation> + </annotations> + </identifier> + </docblock> + </parser> + <output>/** + * regress_constructor: (constructor) + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_destroy.xml b/tests/scanner/annotationparser/gi/annotation_destroy.xml new file mode 100644 index 00000000..e504a962 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_destroy.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_custom_destroy</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>destroy</name> + <options> + <option> + <name>destroy</name> + </option> + </options> + </annotation> + <annotation> + <name>closure</name> + <options> + <option> + <name>data</name> + </option> + </options> + </annotation> + </annotations> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test messing up the heuristic of closure/destroy-notification +detection, and fixing it via annotations.</description> + </docblock> + </parser> + <output>/** + * annotation_custom_destroy: + * @callback: (destroy destroy) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</output> +</test> + +<test> + <input>/** + * annotation_custom_destroy: + * @callback: (destroy destroy=invalid) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_custom_destroy</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>destroy</name> + <options> + <option> + <name>destroy=invalid</name> + </option> + </options> + </annotation> + <annotation> + <name>closure</name> + <options> + <option> + <name>data</name> + </option> + </options> + </annotation> + </annotations> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test messing up the heuristic of closure/destroy-notification +detection, and fixing it via annotations.</description> + </docblock> + <messages> + <message>3: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * @callback: (destroy destroy=invalid) (closure data): Destroy notification + ^</message> + </messages> + </parser> + <output>/** + * annotation_custom_destroy: + * @callback: (destroy destroy=invalid) (closure data): Destroy notification + * + * Test messing up the heuristic of closure/destroy-notification + * detection, and fixing it via annotations. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_element_type.xml b/tests/scanner/annotationparser/gi/annotation_element_type.xml new file mode 100644 index 00000000..65b3dd09 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_element_type.xml @@ -0,0 +1,272 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * foo_test_array: + * @a: (element-type): + * @b: (element-type x y z): + * + * Returns: (element-type utf8) (transfer container): returns %NULL. + */</input> + <parser> + <docblock> + <identifier> + <name>foo_test_array</name> + </identifier> + <parameters> + <parameter> + <name>a</name> + <annotations> + <annotation> + <name>element-type</name> + </annotation> + </annotations> + </parameter> + <parameter> + <name>b</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>x</name> + </option> + <option> + <name>y</name> + </option> + <option> + <name>z</name> + </option> + </options> + </annotation> + </annotations> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + </annotations> + <description>returns %NULL.</description> + </tag> + </tags> + </docblock> + <messages> + <message>3: Warning: Test: "element-type" annotation takes at least one option, none given</message> + <message>4: Warning: Test: "element-type" annotation takes at most 2 options, 3 given</message> + </messages> + </parser> + <output>/** + * foo_test_array: + * @a: (element-type): + * @b: (element-type x y z): + * + * Returns: (element-type utf8) (transfer container): returns %NULL. + */</output> +</test> + +<test> + <input>/** + * RegressTestObj::sig-with-hash-prop: + * @self: an object + * @hash: (element-type utf8 GObject.Value): + * + * This test signal is like TelepathyGlib's + * TpAccount::status-changed + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestObj::sig-with-hash-prop</name> + </identifier> + <parameters> + <parameter> + <name>self</name> + <description>an object</description> + </parameter> + <parameter> + <name>hash</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8</name> + </option> + <option> + <name>GObject.Value</name> + </option> + </options> + </annotation> + </annotations> + </parameter> + </parameters> + <description>This test signal is like TelepathyGlib's + TpAccount::status-changed</description> + </docblock> + </parser> + <output>/** + * RegressTestObj::sig-with-hash-prop: + * @self: an object + * @hash: (element-type utf8 GObject.Value): + * + * This test signal is like TelepathyGlib's + * TpAccount::status-changed + */</output> +</test> + +<test> + <input><![CDATA[/** + * regress_test_ghash_nested_everything_return2: + * + * Another way of specifying nested parameterized types: using the + * element-type annotation. + * + * Return value: (element-type utf8 GLib.HashTable<utf8,utf8>) (transfer full): + */]]></input> + <parser> + <docblock> + <identifier> + <name>regress_test_ghash_nested_everything_return2</name> + </identifier> + <description>Another way of specifying nested parameterized types: using the +element-type annotation.</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8</name> + </option> + <option> + <name>GLib.HashTable(utf8,utf8)</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * regress_test_ghash_nested_everything_return2: + * + * Another way of specifying nested parameterized types: using the + * element-type annotation. + * + * Returns: (element-type utf8 GLib.HashTable(utf8,utf8)) (transfer full): + */</output> +</test> + +<test> + <input> /** + * foo_test_array: + * + * Returns: (element-type invalid utf8=invalid GLib.HashTable(utf8,utf8)): returns %NULL. + */</input> + <parser> + <docblock> + <identifier> + <name>foo_test_array</name> + </identifier> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>invalid utf8=invalid GLib.HashTable(utf8,utf8)</name> + </option> + </options> + </annotation> + </annotations> + <description>returns %NULL.</description> + </tag> + </tags> + </docblock> + <messages> + <message>4: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * Returns: (element-type invalid utf8=invalid GLib.HashTable(utf8,utf8)): returns %NULL. + ^</message> + </messages> + </parser> + <output> /** + * foo_test_array: + * + * Returns: (element-type invalid utf8=invalid GLib.HashTable(utf8,utf8)): returns %NULL. + */</output> +</test> + +<test> + <input> /** + * foo_test_array: + * + * Returns: (element-type utf8=invalid GLib.HashTable(utf8,utf8) invalid): returns %NULL. + */</input> + <parser> + <docblock> + <identifier> + <name>foo_test_array</name> + </identifier> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8=invalid GLib.HashTable(utf8,utf8) invalid</name> + </option> + </options> + </annotation> + </annotations> + <description>returns %NULL.</description> + </tag> + </tags> + </docblock> + <messages> + <message>4: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * Returns: (element-type utf8=invalid GLib.HashTable(utf8,utf8) invalid): returns %NULL. + ^</message> + </messages> + </parser> + <output> /** + * foo_test_array: + * + * Returns: (element-type utf8=invalid GLib.HashTable(utf8,utf8) invalid): returns %NULL. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_foreign.xml b/tests/scanner/annotationparser/gi/annotation_foreign.xml new file mode 100644 index 00000000..e65e9747 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_foreign.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * FooForeignStruct: (foreign) + * + */</input> + <parser> + <docblock> + <identifier> + <name>FooForeignStruct</name> + <annotations> + <annotation> + <name>foreign</name> + </annotation> + </annotations> + </identifier> + </docblock> + </parser> + <output>/** + * FooForeignStruct: (foreign) + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_get_value_func.xml b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml new file mode 100644 index 00000000..3e96f837 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_get_value_func.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>get-value-func</name> + <options> + <option> + <name>regress_test_value_get_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + </parser> + <output>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Get value func:" tag syntax + --> + <input>/** + * RegressTestFundamentalObject: + * + * This object tests regressions... + * + * Get value func: regress_test_value_get_fundamental_object + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>get-value-func</name> + <options> + <option> + <name>regress_test_value_get_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Get value func" has been deprecated, please use annotations on the identifier instead: + * Get value func: regress_test_value_get_fundamental_object + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Get value func:" tag syntax in the wrong location + --> + <input>/** + * RegressTestFundamentalObject: + * + * Get value func: regress_test_value_get_fundamental_object + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>get-value-func</name> + <options> + <option> + <name>regress_test_value_get_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Get value func" has been deprecated, please use annotations on the identifier instead: + * Get value func: regress_test_value_get_fundamental_object + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +<test> + <input>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object=invalid) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>get-value-func</name> + <options> + <option> + <name>regress_test_value_get_fundamental_object=invalid</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>2: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object=invalid) + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (get-value-func regress_test_value_get_fundamental_object=invalid) + * + * This object tests regressions... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_in.xml b/tests/scanner/annotationparser/gi/annotation_in.xml new file mode 100644 index 00000000..26daf5a6 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_in.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_in: + * @object: a #GObject + * @inarg: (in) (transfer none): This is an argument test + * + * This is a test for in arguments + * + * Return value: an int + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_in</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #GObject</description> + </parameter> + <parameter> + <name>inarg</name> + <annotations> + <annotation> + <name>in</name> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>none</name> + </option> + </options> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + </parameters> + <description>This is a test for in arguments</description> + <tags> + <tag> + <name>returns</name> + <description>an int</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_in: + * @object: a #GObject + * @inarg: (in) (transfer none): This is an argument test + * + * This is a test for in arguments + * + * Returns: an int + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_in_out.xml b/tests/scanner/annotationparser/gi/annotation_in_out.xml new file mode 100644 index 00000000..1900229e --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_in_out.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_inout: + * @object: a #GObject + * @inoutarg: (inout): This is an argument test + * @inoutarg2: (in-out): This is an argument test + * + * This is a test for inout arguments + * + * Return value: an int + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_inout</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #GObject</description> + </parameter> + <parameter> + <name>inoutarg</name> + <annotations> + <annotation> + <name>inout</name> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + <parameter> + <name>inoutarg2</name> + <annotations> + <annotation> + <name>inout</name> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + </parameters> + <description>This is a test for inout arguments</description> + <tags> + <tag> + <name>returns</name> + <description>an int</description> + </tag> + </tags> + </docblock> + <messages> + <message>5: Warning: Test: "in-out" annotation has been deprecated, please use "inout" instead: + * @inoutarg2: (in-out): This is an argument test + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_inout: + * @object: a #GObject + * @inoutarg: (inout): This is an argument test + * @inoutarg2: (inout): This is an argument test + * + * This is a test for inout arguments + * + * Returns: an int + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_method.xml b/tests/scanner/annotationparser/gi/annotation_method.xml new file mode 100644 index 00000000..3b9f1b87 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_method.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * regress_forced_method: (method) + * @obj: A #RegressTestObj + */</input> + <parser> + <docblock> + <identifier> + <name>regress_forced_method</name> + <annotations> + <annotation> + <name>method</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>obj</name> + <description>A #RegressTestObj</description> + </parameter> + </parameters> + </docblock> + </parser> + <output>/** + * regress_forced_method: (method) + * @obj: A #RegressTestObj + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_out.xml b/tests/scanner/annotationparser/gi/annotation_out.xml new file mode 100644 index 00000000..7bfc8638 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_out.xml @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_out: + * @object: a #GObject + * @outarg: (out): This is an argument test + * + * This is a test for out arguments + * + * Return value: an int + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_out</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #GObject</description> + </parameter> + <parameter> + <name>outarg</name> + <annotations> + <annotation> + <name>out</name> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + </parameters> + <description>This is a test for out arguments</description> + <tags> + <tag> + <name>returns</name> + <description>an int</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_out: + * @object: a #GObject + * @outarg: (out): This is an argument test + * + * This is a test for out arguments + * + * Returns: an int + */</output> +</test> + +<test> + <input>/** + * regress_test_struct_a_clone: + * @a: the structure + * @a_out: (out caller-allocates): the cloned structure + */</input> + <parser> + <docblock> + <identifier> + <name>regress_test_struct_a_clone</name> + </identifier> + <parameters> + <parameter> + <name>a</name> + <description>the structure</description> + </parameter> + <parameter> + <name>a_out</name> + <annotations> + <annotation> + <name>out</name> + <options> + <option> + <name>caller-allocates</name> + </option> + </options> + </annotation> + </annotations> + <description>the cloned structure</description> + </parameter> + </parameters> + </docblock> + </parser> + <output>/** + * regress_test_struct_a_clone: + * @a: the structure + * @a_out: (out caller-allocates): the cloned structure + */</output> +</test> + +<test> + <input>/** + * regress_test_struct_a_clone: + * @a: the structure + * @a_out: (out callee-allocates): the cloned structure + */</input> + <parser> + <docblock> + <identifier> + <name>regress_test_struct_a_clone</name> + </identifier> + <parameters> + <parameter> + <name>a</name> + <description>the structure</description> + </parameter> + <parameter> + <name>a_out</name> + <annotations> + <annotation> + <name>out</name> + <options> + <option> + <name>callee-allocates</name> + </option> + </options> + </annotation> + </annotations> + <description>the cloned structure</description> + </parameter> + </parameters> + </docblock> + </parser> + <output>/** + * regress_test_struct_a_clone: + * @a: the structure + * @a_out: (out callee-allocates): the cloned structure + */</output> +</test> + +<test> + <input>/** + * regress_test_struct_a_clone: + * @a: (out invalid): the structure + * @a_out: (out callee-allocates=invalid): the cloned structure + */</input> + <parser> + <docblock> + <identifier> + <name>regress_test_struct_a_clone</name> + </identifier> + <parameters> + <parameter> + <name>a</name> + <annotations> + <annotation> + <name>out</name> + <options> + <option> + <name>invalid</name> + </option> + </options> + </annotation> + </annotations> + <description>the structure</description> + </parameter> + <parameter> + <name>a_out</name> + <annotations> + <annotation> + <name>out</name> + <options> + <option> + <name>callee-allocates=invalid</name> + </option> + </options> + </annotation> + </annotations> + <description>the cloned structure</description> + </parameter> + </parameters> + </docblock> + <messages> + <message>4: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * @a_out: (out callee-allocates=invalid): the cloned structure + ^</message> + <message>3: Warning: Test: invalid "out" annotation option: "invalid"</message> + <message>4: Warning: Test: invalid "out" annotation option: "callee-allocates=invalid"</message> + </messages> + </parser> + <output>/** + * regress_test_struct_a_clone: + * @a: (out invalid): the structure + * @a_out: (out callee-allocates=invalid): the cloned structure + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_ref_func.xml b/tests/scanner/annotationparser/gi/annotation_ref_func.xml new file mode 100644 index 00000000..a967102a --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_ref_func.xml @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>ref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_ref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + </parser> + <output>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Ref func:" tag syntax + --> + <input>/** + * RegressTestFundamentalObject: + * + * This object tests regressions... + * + * Ref func: regress_test_fundamental_object_ref + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>ref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_ref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Ref func" has been deprecated, please use annotations on the identifier instead: + * Ref func: regress_test_fundamental_object_ref + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Ref func:" tag syntax in the wrong location + --> + <input>/** + * RegressTestFundamentalObject: + * + * Ref func: regress_test_fundamental_object_ref + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>ref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_ref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Ref func" has been deprecated, please use annotations on the identifier instead: + * Ref func: regress_test_fundamental_object_ref + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref) + * + * This object tests regressions... + */</output> +</test> + +<test> + <input>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref=invalid) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>ref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_ref=invalid</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>2: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref=invalid) + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref=invalid) + * + * This object tests regressions... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_rename_to.xml b/tests/scanner/annotationparser/gi/annotation_rename_to.xml new file mode 100644 index 00000000..2987d889 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_rename_to.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_watch_full: (rename-to annotation_object_watch) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch_full</name> + <annotations> + <annotation> + <name>rename-to</name> + <options> + <option> + <name>annotation_object_watch</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>A #AnnotationObject</description> + </parameter> + <parameter> + <name>func</name> + <description>The callback</description> + </parameter> + <parameter> + <name>user_data</name> + <description>The callback data</description> + </parameter> + <parameter> + <name>destroy</name> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test overriding via the "Rename To" annotation.</description> + </docblock> + </parser> + <output>/** + * annotation_object_watch_full: (rename-to annotation_object_watch) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + */</output> +</test> + +<test> + <!-- + Deprecated "Rename to:" tag syntax + --> + <input>/** + * annotation_object_watch_full: + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + * + * Rename to: annotation_object_watch + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch_full</name> + <annotations> + <annotation> + <name>rename-to</name> + <options> + <option> + <name>annotation_object_watch</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>A #AnnotationObject</description> + </parameter> + <parameter> + <name>func</name> + <description>The callback</description> + </parameter> + <parameter> + <name>user_data</name> + <description>The callback data</description> + </parameter> + <parameter> + <name>destroy</name> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test overriding via the "Rename To" annotation.</description> + </docblock> + <messages> + <message>10: Warning: Test: GObject-Introspection specific GTK-Doc tag "Rename to" has been deprecated, please use annotations on the identifier instead: + * Rename to: annotation_object_watch + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_watch_full: (rename-to annotation_object_watch) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + */</output> +</test> + +<test> + <!-- + Deprecated "Rename to:" tag syntax in the wrong location + --> + <input>/** + * annotation_object_watch_full: + * + * Rename to: annotation_object_watch + * + * Test overriding via the "Rename To" annotation. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch_full</name> + <annotations> + <annotation> + <name>rename-to</name> + <options> + <option> + <name>annotation_object_watch</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test overriding via the "Rename To" annotation.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Rename to" has been deprecated, please use annotations on the identifier instead: + * Rename to: annotation_object_watch + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_watch_full: (rename-to annotation_object_watch) + * + * Test overriding via the "Rename To" annotation. + */</output> +</test> + +<test> + <input>/** + * annotation_object_watch_full: (rename-to annotation_object_watch=invalid) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch_full</name> + <annotations> + <annotation> + <name>rename-to</name> + <options> + <option> + <name>annotation_object_watch=invalid</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>A #AnnotationObject</description> + </parameter> + <parameter> + <name>func</name> + <description>The callback</description> + </parameter> + <parameter> + <name>user_data</name> + <description>The callback data</description> + </parameter> + <parameter> + <name>destroy</name> + <description>Destroy notification</description> + </parameter> + </parameters> + <description>Test overriding via the "Rename To" annotation.</description> + </docblock> + <messages> + <message>2: Warning: Test: invalid annotation options: expected a "list" but received "key=value pairs": + * annotation_object_watch_full: (rename-to annotation_object_watch=invalid) + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_watch_full: (rename-to annotation_object_watch=invalid) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * @destroy: Destroy notification + * + * Test overriding via the "Rename To" annotation. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_scope.xml b/tests/scanner/annotationparser/gi/annotation_scope.xml new file mode 100644 index 00000000..3a22274a --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_scope.xml @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_foreach: + * @object: a #AnnotationObject + * @func: (scope call): Callback to invoke + * @user_data: Callback user data + * + * Test taking a call-scoped callback + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_foreach</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #AnnotationObject</description> + </parameter> + <parameter> + <name>func</name> + <annotations> + <annotation> + <name>scope</name> + <options> + <option> + <name>call</name> + </option> + </options> + </annotation> + </annotations> + <description>Callback to invoke</description> + </parameter> + <parameter> + <name>user_data</name> + <description>Callback user data</description> + </parameter> + </parameters> + <description>Test taking a call-scoped callback</description> + </docblock> + </parser> + <output>/** + * annotation_object_foreach: + * @object: a #AnnotationObject + * @func: (scope call): Callback to invoke + * @user_data: Callback user data + * + * Test taking a call-scoped callback + */</output> +</test> + +<test> + <input>/** + * regress_test_callback_destroy_notify: + * @callback: (scope notified): + * + * Notified - callback persists until a DestroyNotify delegate + * is invoked. + **/</input> + <parser> + <docblock> + <identifier> + <name>regress_test_callback_destroy_notify</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>scope</name> + <options> + <option> + <name>notified</name> + </option> + </options> + </annotation> + </annotations> + </parameter> + </parameters> + <description>Notified - callback persists until a DestroyNotify delegate +is invoked.</description> + </docblock> + </parser> + <output>/** + * regress_test_callback_destroy_notify: + * @callback: (scope notified): + * + * Notified - callback persists until a DestroyNotify delegate + * is invoked. + */</output> +</test> + +<test> + <input>/** + * regress_test_callback_async: + * @callback: (scope async): + * + **/</input> + <parser> + <docblock> + <identifier> + <name>regress_test_callback_async</name> + </identifier> + <parameters> + <parameter> + <name>callback</name> + <annotations> + <annotation> + <name>scope</name> + <options> + <option> + <name>async</name> + </option> + </options> + </annotation> + </annotations> + </parameter> + </parameters> + </docblock> + </parser> + <output>/** + * regress_test_callback_async: + * @callback: (scope async): + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_set_value_func.xml b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml new file mode 100644 index 00000000..f98944b5 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_set_value_func.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>set-value-func</name> + <options> + <option> + <name>regress_test_value_set_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + </parser> + <output>/** + * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Set value func:" tag syntax + --> + <input>/** + * RegressTestFundamentalObject: + * + * This object tests regressions... + * + * Set value func: regress_test_value_set_fundamental_object + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>set-value-func</name> + <options> + <option> + <name>regress_test_value_set_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Set value func" has been deprecated, please use annotations on the identifier instead: + * Set value func: regress_test_value_set_fundamental_object + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Set value func:" tag syntax in the wrong location + --> + <input>/** + * RegressTestFundamentalObject: + * + * Set value func: regress_test_value_set_fundamental_object + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>set-value-func</name> + <options> + <option> + <name>regress_test_value_set_fundamental_object</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Set value func" has been deprecated, please use annotations on the identifier instead: + * Set value func: regress_test_value_set_fundamental_object + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (set-value-func regress_test_value_set_fundamental_object) + * + * This object tests regressions... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_skip.xml b/tests/scanner/annotationparser/gi/annotation_skip.xml new file mode 100644 index 00000000..e0352e03 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_skip.xml @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_watch: (skip) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * + * This is here just for the sake of being overriden by its + * annotation_object_watch_full(). + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>A #AnnotationObject</description> + </parameter> + <parameter> + <name>func</name> + <description>The callback</description> + </parameter> + <parameter> + <name>user_data</name> + <description>The callback data</description> + </parameter> + </parameters> + <description>This is here just for the sake of being overriden by its +annotation_object_watch_full().</description> + </docblock> + </parser> + <output>/** + * annotation_object_watch: (skip) + * @object: A #AnnotationObject + * @func: The callback + * @user_data: The callback data + * + * This is here just for the sake of being overriden by its + * annotation_object_watch_full(). + */</output> +</test> + +<test> + <input>/** + * annotation_object_watch: (skip yes) + * + * This is here just for the sake of being overriden by its + * annotation_object_watch_full(). + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_watch</name> + <annotations> + <annotation> + <name>skip</name> + <options> + <option> + <name>yes</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is here just for the sake of being overriden by its +annotation_object_watch_full().</description> + </docblock> + <messages> + <message>2: Warning: Test: "skip" annotation needs no options, 1 given</message> + </messages> + </parser> + <output>/** + * annotation_object_watch: (skip yes) + * + * This is here just for the sake of being overriden by its + * annotation_object_watch_full(). + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_transfer.xml b/tests/scanner/annotationparser/gi/annotation_transfer.xml new file mode 100644 index 00000000..9b4ded1a --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_transfer.xml @@ -0,0 +1,285 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * AnnotationObject::list-signal: + * @annotation: the annotation object + * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings + * + * This is a signal which takes a list of strings, but it's not + * known by GObject as it's only marked as G_TYPE_POINTER + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject::list-signal</name> + </identifier> + <parameters> + <parameter> + <name>annotation</name> + <description>the annotation object</description> + </parameter> + <parameter> + <name>list</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.List</name> + </option> + </options> + </annotation> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + </annotations> + <description>a list of strings</description> + </parameter> + </parameters> + <description>This is a signal which takes a list of strings, but it's not +known by GObject as it's only marked as G_TYPE_POINTER</description> + </docblock> + </parser> + <output>/** + * AnnotationObject::list-signal: + * @annotation: the annotation object + * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings + * + * This is a signal which takes a list of strings, but it's not + * known by GObject as it's only marked as G_TYPE_POINTER + */</output> +</test> + +<test> + <input>/** + * annotation_object_in: + * @object: a #GObject + * @inarg: (in) (transfer none): This is an argument test + * + * This is a test for in arguments + * + * Return value: an int + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_in</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>a #GObject</description> + </parameter> + <parameter> + <name>inarg</name> + <annotations> + <annotation> + <name>in</name> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>none</name> + </option> + </options> + </annotation> + </annotations> + <description>This is an argument test</description> + </parameter> + </parameters> + <description>This is a test for in arguments</description> + <tags> + <tag> + <name>returns</name> + <description>an int</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_in: + * @object: a #GObject + * @inarg: (in) (transfer none): This is an argument test + * + * This is a test for in arguments + * + * Returns: an int + */</output> +</test> + +<test> + <input>/** + * annotation_transfer_floating: + * + * Returns: (transfer floating): A floating object + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_transfer_floating</name> + </identifier> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>floating</name> + </option> + </options> + </annotation> + </annotations> + <description>A floating object</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_transfer_floating: + * + * Returns: (transfer floating): A floating object + */</output> +</test> + +<test> + <input>/** + * FsSession:codecs-without-config: (transfer full) + * + * This is the same list of codecs as #FsSession:codecs + * without.... + */</input> + <parser> + <docblock> + <identifier> + <name>FsSession:codecs-without-config</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is the same list of codecs as #FsSession:codecs +without....</description> + </docblock> + </parser> + <output>/** + * FsSession:codecs-without-config: (transfer full) + * + * This is the same list of codecs as #FsSession:codecs + * without.... + */</output> +</test> + +<test> + <!-- + Deprecated "Transfer:" tag syntax + --> + <input>/** + * FsSession:codecs-without-config: + * + * This is the same list of codecs as #FsSession:codecs + * without.... + * + * Transfer: full + */</input> + <parser> + <docblock> + <identifier> + <name>FsSession:codecs-without-config</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is the same list of codecs as #FsSession:codecs +without....</description> + </docblock> + <messages> + <message>7: Warning: Test: GObject-Introspection specific GTK-Doc tag "Transfer" has been deprecated, please use annotations on the identifier instead: + * Transfer: full + ^</message> + </messages> + </parser> + <output>/** + * FsSession:codecs-without-config: (transfer full) + * + * This is the same list of codecs as #FsSession:codecs + * without.... + */</output> +</test> + +<test> + <!-- + Deprecated "Transfer:" tag syntax in the wrong location + --> + <input>/** + * FsSession:codecs-without-config: + * + * Transfer: full + * + * This is the same list of codecs as #FsSession:codecs + * without.... + */</input> + <parser> + <docblock> + <identifier> + <name>FsSession:codecs-without-config</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is the same list of codecs as #FsSession:codecs +without....</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Transfer" has been deprecated, please use annotations on the identifier instead: + * Transfer: full + ^</message> + </messages> + </parser> + <output>/** + * FsSession:codecs-without-config: (transfer full) + * + * This is the same list of codecs as #FsSession:codecs + * without.... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_type.xml b/tests/scanner/annotationparser/gi/annotation_type.xml new file mode 100644 index 00000000..c3d6351d --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_type.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * AnnotationObject::list-signal: + * @annotation: the annotation object + * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings + * + * This is a signal which takes a list of strings, but it's not + * known by GObject as it's only marked as G_TYPE_POINTER + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject::list-signal</name> + </identifier> + <parameters> + <parameter> + <name>annotation</name> + <description>the annotation object</description> + </parameter> + <parameter> + <name>list</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.List</name> + </option> + </options> + </annotation> + <annotation> + <name>element-type</name> + <options> + <option> + <name>utf8</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + </annotations> + <description>a list of strings</description> + </parameter> + </parameters> + <description>This is a signal which takes a list of strings, but it's not +known by GObject as it's only marked as G_TYPE_POINTER</description> + </docblock> + </parser> + <output>/** + * AnnotationObject::list-signal: + * @annotation: the annotation object + * @list: (type GLib.List) (element-type utf8) (transfer container): a list of strings + * + * This is a signal which takes a list of strings, but it's not + * known by GObject as it's only marked as G_TYPE_POINTER + */</output> +</test> + +<test> + <input>/** + * AnnotationObject:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container) + */</input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject:hash-table</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + </docblock> + </parser> + <output>/** + * AnnotationObject:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container) + */</output> +</test> + +<test> + <!-- + Deprecated inequality sign/angled brackets notation. + --> + <input><![CDATA[/** + * AnnotationObject:hash-table: (type GLib.HashTable<utf8,gint8>) (transfer container) + */]]></input> + <parser> + <docblock> + <identifier> + <name>AnnotationObject:hash-table</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + </docblock> + </parser> + <output>/** + * AnnotationObject:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container) + */</output> +</test> + +<test> + <!-- + Deprecated "Type:" tag syntax + --> + <input>/** + * RegressTestObj:hash-table: + * + * Test. + * + * Type: GLib.HashTable(utf8,gint8) + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestObj:hash-table</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test.</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Type" has been deprecated, please use annotations on the identifier instead: + * Type: GLib.HashTable(utf8,gint8) + ^</message> + </messages> + </parser> + <output>/** + * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8)) + * + * Test. + */</output> +</test> + +<test> + <!-- + Deprecated "Type:" tag syntax in the wrong location + --> + <input>/** + * RegressTestObj:hash-table: + * + * Type: GLib.HashTable(utf8,gint8) + * + * Test. + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestObj:hash-table</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Type" has been deprecated, please use annotations on the identifier instead: + * Type: GLib.HashTable(utf8,gint8) + ^</message> + </messages> + </parser> + <output>/** + * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8)) + * + * Test. + */</output> +</test> + +<test> + <!-- + Deprecated angled brackets in deprecated "Type:" tag syntax + --> + <input><![CDATA[/** + * RegressTestObj:hash-table: + * + * Test. + * + * Type: GLib.HashTable<utf8,gint8> + */]]></input> + <parser> + <docblock> + <identifier> + <name>RegressTestObj:hash-table</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test.</description> + </docblock> + <messages> + <message><![CDATA[6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Type" has been deprecated, please use annotations on the identifier instead: + * Type: GLib.HashTable<utf8,gint8> + ^]]></message> + </messages> + </parser> + <output>/** + * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8)) + * + * Test. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_unref_func.xml b/tests/scanner/annotationparser/gi/annotation_unref_func.xml new file mode 100644 index 00000000..59f3f8d4 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_unref_func.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref) + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>unref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_unref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + </parser> + <output>/** + * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Unref func:" tag syntax + --> + <input>/** + * RegressTestFundamentalObject: + * + * This object tests regressions... + * + * Unref func: regress_test_fundamental_object_unref + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>unref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_unref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Unref func" has been deprecated, please use annotations on the identifier instead: + * Unref func: regress_test_fundamental_object_unref + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref) + * + * This object tests regressions... + */</output> +</test> + +<test> + <!-- + Deprecated "Unref func:" tag syntax in the wrong location + --> + <input>/** + * RegressTestFundamentalObject: + * + * Unref func: regress_test_fundamental_object_unref + * + * This object tests regressions... + */</input> + <parser> + <docblock> + <identifier> + <name>RegressTestFundamentalObject</name> + <annotations> + <annotation> + <name>unref-func</name> + <options> + <option> + <name>regress_test_fundamental_object_unref</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This object tests regressions...</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Unref func" has been deprecated, please use annotations on the identifier instead: + * Unref func: regress_test_fundamental_object_unref + ^</message> + </messages> + </parser> + <output>/** + * RegressTestFundamentalObject: (unref-func regress_test_fundamental_object_unref) + * + * This object tests regressions... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_value.xml b/tests/scanner/annotationparser/gi/annotation_value.xml new file mode 100644 index 00000000..7d72ef71 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_value.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) + * + * Constant to define a calculated large value + */</input> + <parser> + <docblock> + <identifier> + <name>ANNOTATION_CALCULATED_LARGE</name> + <annotations> + <annotation> + <name>value</name> + <options> + <option> + <name>10000000000UL</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Constant to define a calculated large value</description> + </docblock> + </parser> + <output>/** + * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) + * + * Constant to define a calculated large value + */</output> +</test> + +<test> + <!-- + Deprecated "Value:" tag syntax + --> + <input>/** + * ANNOTATION_CALCULATED_LARGE: + * + * Constant to define a calculated large value + * + * Value: 10000000000UL + */</input> + <parser> + <docblock> + <identifier> + <name>ANNOTATION_CALCULATED_LARGE</name> + <annotations> + <annotation> + <name>value</name> + <options> + <option> + <name>10000000000UL</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Constant to define a calculated large value</description> + </docblock> + <messages> + <message>6: Warning: Test: GObject-Introspection specific GTK-Doc tag "Value" has been deprecated, please use annotations on the identifier instead: + * Value: 10000000000UL + ^</message> + </messages> + </parser> + <output>/** + * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) + * + * Constant to define a calculated large value + */</output> +</test> + +<test> + <!-- + Deprecated "Value:" tag syntax in the wrong location + --> + <input>/** + * ANNOTATION_CALCULATED_LARGE: + * + * Value: 10000000000UL + * + * Constant to define a calculated large value + */</input> + <parser> + <docblock> + <identifier> + <name>ANNOTATION_CALCULATED_LARGE</name> + <annotations> + <annotation> + <name>value</name> + <options> + <option> + <name>10000000000UL</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Constant to define a calculated large value</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Value" has been deprecated, please use annotations on the identifier instead: + * Value: 10000000000UL + ^</message> + </messages> + </parser> + <output>/** + * ANNOTATION_CALCULATED_LARGE: (value 10000000000UL) + * + * Constant to define a calculated large value + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotation_virtual.xml b/tests/scanner/annotationparser/gi/annotation_virtual.xml new file mode 100644 index 00000000..3321eea0 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_virtual.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * foo_object_read: (virtual read_fn) + * @object: obj + * @offset: offset + * @length: length + * + * Read some stuff. + */</input> + <parser> + <docblock> + <identifier> + <name>foo_object_read</name> + <annotations> + <annotation> + <name>virtual</name> + <options> + <option> + <name>read_fn</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>obj</description> + </parameter> + <parameter> + <name>offset</name> + <description>offset</description> + </parameter> + <parameter> + <name>length</name> + <description>length</description> + </parameter> + </parameters> + <description>Read some stuff.</description> + </docblock> + </parser> + <output>/** + * foo_object_read: (virtual read_fn) + * @object: obj + * @offset: offset + * @length: length + * + * Read some stuff. + */</output> +</test> + +<test> + <!-- + Deprecated "Virtual:" tag syntax + --> + <input>/** + * foo_object_read: + * @object: obj + * @offset: offset + * @length: length + * + * Read some stuff. + * + * Virtual: read_fn + */</input> + <parser> + <docblock> + <identifier> + <name>foo_object_read</name> + <annotations> + <annotation> + <name>virtual</name> + <options> + <option> + <name>read_fn</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>obj</description> + </parameter> + <parameter> + <name>offset</name> + <description>offset</description> + </parameter> + <parameter> + <name>length</name> + <description>length</description> + </parameter> + </parameters> + <description>Read some stuff.</description> + </docblock> + <messages> + <message>9: Warning: Test: GObject-Introspection specific GTK-Doc tag "Virtual" has been deprecated, please use annotations on the identifier instead: + * Virtual: read_fn + ^</message> + </messages> + </parser> + <output>/** + * foo_object_read: (virtual read_fn) + * @object: obj + * @offset: offset + * @length: length + * + * Read some stuff. + */</output> +</test> + +<test> + <!-- + Deprecated "Virtual:" tag syntax in the wrong location + --> + <input>/** + * foo_object_read: + * + * Virtual: read_fn + * + * Read some stuff. + */</input> + <parser> + <docblock> + <identifier> + <name>foo_object_read</name> + <annotations> + <annotation> + <name>virtual</name> + <options> + <option> + <name>read_fn</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Read some stuff.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Virtual" has been deprecated, please use annotations on the identifier instead: + * Virtual: read_fn + ^</message> + </messages> + </parser> + <output>/** + * foo_object_read: (virtual read_fn) + * + * Read some stuff. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/annotations.xml b/tests/scanner/annotationparser/gi/annotations.xml new file mode 100644 index 00000000..a7ca8e74 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotations.xml @@ -0,0 +1,637 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_test: (skip) (skip) + * + * Oops. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <description>Oops.</description> + </docblock> + <messages> + <message>2: Error: Test: multiple "skip" annotations: + * annotation_test: (skip) (skip) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: (skip) + * + * Oops. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (hello) (world) + * @param: (invalid-annotation-option): sizeof (x) == 1 + * + * Test unknown annotations without options. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>hello</name> + </annotation> + <annotation> + <name>world</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>param</name> + <annotations> + <annotation> + <name>invalid-annotation-option</name> + </annotation> + </annotations> + <description>sizeof (x) == 1</description> + </parameter> + </parameters> + <description>Test unknown annotations without options.</description> + </docblock> + <messages> + <message>2: Warning: Test: unknown annotation: hello</message> + <message>2: Warning: Test: unknown annotation: world</message> + <message>3: Warning: Test: unknown annotation: invalid-annotation-option</message> + </messages> + </parser> + <output>/** + * annotation_test: (hello) (world) + * @param: (invalid-annotation-option): sizeof (x) == 1 + * + * Test unknown annotations without options. + */</output> +</test> + +<test> + <input>/** + * annotation_test: some data: (foo bar) + * + * Oops. + */</input> + <parser> + <messages> + <message>2: Error: Test: identifier not found on the first line: + * annotation_test: some data: (foo bar) + ^</message> + </messages> + </parser> +</test> + +<test> + <input>/** + * annotationtest some data (foo bar) + * @object: some data (foo bar) + * + * Oops. + */</input> + <parser> + <messages> + <message>2: Error: Test: identifier not found on the first line: + * annotationtest some data (foo bar) + ^</message> + </messages> + </parser> +</test> + +<test> + <input>/** + * annotationtest + * @object: some data (foo bar) + * + * Oops. + */</input> + <parser> + <docblock> + <identifier> + <name>annotationtest</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <description>some data (foo bar)</description> + </parameter> + </parameters> + <description>Oops.</description> + </docblock> + </parser> + <output>/** + * annotationtest: + * @object: some data (foo bar) + * + * Oops. + */</output> +</test> + +<test> + <input>/** + * annotation_test: )skip) + * + * Oops. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Oops.</description> + </docblock> + <messages> + <message>2: Error: Test: unbalanced parentheses, annotations will be ignored: + * annotation_test: )skip) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Oops. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (hello)(world) + * + * Test unknown annotations without options. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>hello</name> + </annotation> + <annotation> + <name>world</name> + </annotation> + </annotations> + </identifier> + <description>Test unknown annotations without options.</description> + </docblock> + <messages> + <message>2: Warning: Test: unknown annotation: hello</message> + <message>2: Warning: Test: unknown annotation: world</message> + </messages> + </parser> + <output>/** + * annotation_test: (hello) (world) + * + * Test unknown annotations without options. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (hello x=y z ) (world something else) + * + * Test unknown annotations with options. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>hello</name> + <options> + <option> + <name>x=y z</name> + </option> + </options> + </annotation> + <annotation> + <name>world</name> + <options> + <option> + <name>something else</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test unknown annotations with options.</description> + </docblock> + <messages> + <message>2: Warning: Test: unknown annotation: hello</message> + <message>2: Warning: Test: unknown annotation: world</message> + </messages> + </parser> + <output>/** + * annotation_test: (hello x=y z) (world something else) + * + * Test unknown annotations with options. + */</output> +</test> + +<test> + <input>/** + * annotation_test: + * @test: (element-type gint gint) (transfer none) + * + * Test multiple identical option names. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <parameters> + <parameter> + <name>test</name> + <annotations> + <annotation> + <name>element-type</name> + <options> + <option> + <name>gint</name> + </option> + <option> + <name>gint</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>none</name> + </option> + </options> + </annotation> + </annotations> + </parameter> + </parameters> + <description>Test multiple identical option names.</description> + </docblock> + </parser> + <output>/** + * annotation_test: + * @test: (element-type gint gint) (transfer none): + * + * Test multiple identical option names. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (type GLib.HashTable(utf8,gint8)) (attributes x=1 y=2) + * + * Test nested parentheses. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,gint8)</name> + </option> + </options> + </annotation> + <annotation> + <name>attributes</name> + <options> + <option> + <name>x</name> + <value>1</value> + </option> + <option> + <name>y</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test nested parentheses.</description> + </docblock> + </parser> + <output>/** + * annotation_test: (type GLib.HashTable(utf8,gint8)) (attributes x=1 y=2) + * + * Test nested parentheses. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (type GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))) (attributes x=1 y=2) + * + * Test nested parentheses. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))</name> + </option> + </options> + </annotation> + <annotation> + <name>attributes</name> + <options> + <option> + <name>x</name> + <value>1</value> + </option> + <option> + <name>y</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test nested parentheses.</description> + </docblock> + </parser> + <output>/** + * annotation_test: (type GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))) (attributes x=1 y=2) + * + * Test nested parentheses. + */</output> +</test> + +<test> + <input><![CDATA[/** + * annotation_test: (type GLib.HashTable<utf8,GLib.HashTable<utf8,gint8>>) (attributes x=1 y=2) + * + * Test deprecated angled brackets. + */]]></input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))</name> + </option> + </options> + </annotation> + <annotation> + <name>attributes</name> + <options> + <option> + <name>x</name> + <value>1</value> + </option> + <option> + <name>y</name> + <value>2</value> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>Test deprecated angled brackets.</description> + </docblock> + </parser> + <output>/** + * annotation_test: (type GLib.HashTable(utf8,GLib.HashTable(utf8,gint8))) (attributes x=1 y=2) + * + * Test deprecated angled brackets. + */</output> +</test> + +<test> + <input>/** + * annotation_test: ((skip) + * + * Test too many '('. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Test too many '('.</description> + </docblock> + <messages> + <message>2: Error: Test: unexpected parentheses, annotations will be ignored: + * annotation_test: ((skip) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Test too many '('. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (skip) element-type (int)) + * + * Test missing '('. + */</input> + <parser> + <messages> + <message>2: Error: Test: identifier not found on the first line: + * annotation_test: (skip) element-type (int)) + ^</message> + </messages> + </parser> +</test> + +<test> + <input>/** + * annotation_test: () + * + * Closing should not follow an opening parentheses. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Closing should not follow an opening parentheses.</description> + </docblock> + <messages> + <message>2: Error: Test: unexpected parentheses, annotations will be ignored: + * annotation_test: () + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Closing should not follow an opening parentheses. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (hello()) (world(())) (foo) + * + * Closing should not follow an opening parentheses. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Closing should not follow an opening parentheses.</description> + </docblock> + <messages> + <message>2: Error: Test: unexpected parentheses, annotations will be ignored: + * annotation_test: (hello()) (world(())) (foo) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Closing should not follow an opening parentheses. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (skip)) (type uint)) + * + * Test too many ')'. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Test too many ')'.</description> + </docblock> + <messages> + <message>2: Error: Test: unbalanced parentheses, annotations will be ignored: + * annotation_test: (skip)) (type uint)) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Test too many ')'. + */</output> +</test> + +<test> + <input><![CDATA[/** + * annotation_test: + * @test: (type GLib.HashTableutf8,gint8)) (element-type <int>) + * + * Test missing '('. + */]]></input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <parameters> + <parameter> + <name>test</name> + </parameter> + </parameters> + <description>Test missing '('.</description> + </docblock> + <messages> + <message><![CDATA[3: Error: Test: unbalanced parentheses, annotations will be ignored: + * @test: (type GLib.HashTableutf8,gint8)) (element-type <int>) + ^]]></message> + </messages> + </parser> + <output>/** + * annotation_test: + * @test: + * + * Test missing '('. + */</output> +</test> + +<test> + <input>/** + * annotation_test: (skip (element-type (int)) + * + * Test missing ')'. + */</input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <description>Test missing ')'.</description> + </docblock> + <messages> + <message>2: Error: Test: unbalanced parentheses, annotations will be ignored: + * annotation_test: (skip (element-type (int)) + ^</message> + </messages> + </parser> + <output>/** + * annotation_test: + * + * Test missing ')'. + */</output> +</test> + +<test> + <input><![CDATA[/** + * annotation_test: + * @test: (type GLib.HashTable(utf8,gint8) (element-type <int>) + * + * Test missing ')'. + */]]></input> + <parser> + <docblock> + <identifier> + <name>annotation_test</name> + </identifier> + <parameters> + <parameter> + <name>test</name> + </parameter> + </parameters> + <description>Test missing ')'.</description> + </docblock> + <messages> + <message><![CDATA[3: Error: Test: unbalanced parentheses, annotations will be ignored: + * @test: (type GLib.HashTable(utf8,gint8) (element-type <int>) + ^]]></message> + </messages> + </parser> + <output>/** + * annotation_test: + * @test: + * + * Test missing ')'. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/identifier.xml b/tests/scanner/annotationparser/gi/identifier.xml new file mode 100644 index 00000000..eb090307 --- /dev/null +++ b/tests/scanner/annotationparser/gi/identifier.xml @@ -0,0 +1,122 @@ +<?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> + <docblock> + <identifier> + <name>SECTION:test_invalid_section_identifier</name> + </identifier> + <description>Above identifier is not on the first line.</description> + </docblock> + <messages> + <message>2: Error: Test: identifier not found on the first line: + * This is not a valid section identifier + ^</message> + </messages> + </parser> + <output>/** + * SECTION:test_invalid_section_identifier + * + * Above identifier is not on the first line. + */</output> +</test> + +<test> + <!-- + Identifier part not on the first line. + --> + <input>/** + + + +* SECTION:meepapp +*/</input> + <parser> + <docblock> + <identifier> + <name>SECTION:meepapp</name> + </identifier> + </docblock> + <messages> + <message>2: Error: Test: identifier not found on the first line: + +^</message> + </messages> + </parser> + <output>/** + * SECTION:meepapp + */</output> +</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> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * + * SECTION:meepapp2 + * The application class handles ... + */</output> +</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: Error: Test: identifier not found on the first line: + * 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_section.xml b/tests/scanner/annotationparser/gi/identifier_section.xml new file mode 100644 index 00000000..fad2b2ed --- /dev/null +++ b/tests/scanner/annotationparser/gi/identifier_section.xml @@ -0,0 +1,332 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <!-- + Section documentation including all optional metadata. + --> + <input>/** + * SECTION:meepapp + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * 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> + <parameter> + <name>title</name> + <description>Meep application</description> + </parameter> + <parameter> + <name>section_id</name> + </parameter> + <parameter> + <name>see_also</name> + <description>#MeepSettings</description> + </parameter> + <parameter> + <name>stability</name> + <description>Stable</description> + </parameter> + <parameter> + <name>include</name> + <description>meep/app.h</description> + </parameter> + <parameter> + <name>image</name> + <description>application.png</description> + </parameter> + </parameters> + <description>The application class handles ...</description> + </docblock> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * The application class handles ... + */</output> +</test> + +<test> + <!-- + Broken comment block with empty line between identifier and parameters parts. + --> + <input>/** + * SECTION:meepapp + * + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * 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> + <parameter> + <name>title</name> + <description>Meep application</description> + </parameter> + <parameter> + <name>section_id</name> + </parameter> + <parameter> + <name>see_also</name> + <description>#MeepSettings</description> + </parameter> + <parameter> + <name>stability</name> + <description>Stable</description> + </parameter> + <parameter> + <name>include</name> + <description>meep/app.h</description> + </parameter> + <parameter> + <name>image</name> + <description>application.png</description> + </parameter> + </parameters> + <description>The application class handles ...</description> + </docblock> + <messages> + <message>4: Warning: Test: "@short_description" parameter unexpected at this location: + * @short_description: the application class + ^</message> + </messages> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * The application class handles ... + */</output> +</test> + +<test> + <!-- + Broken comment block with description part before parameters part, without empty line. + --> + <input>/** + * SECTION:meepapp + * + * The application class handles ... + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:meepapp</name> + </identifier> + <parameters> + <parameter> + <name>short_description</name> + <description>the application class</description> + </parameter> + <parameter> + <name>title</name> + <description>Meep application</description> + </parameter> + <parameter> + <name>section_id</name> + </parameter> + <parameter> + <name>see_also</name> + <description>#MeepSettings</description> + </parameter> + <parameter> + <name>stability</name> + <description>Stable</description> + </parameter> + <parameter> + <name>include</name> + <description>meep/app.h</description> + </parameter> + <parameter> + <name>image</name> + <description>application.png</description> + </parameter> + </parameters> + <description>The application class handles ...</description> + </docblock> + <messages> + <message>5: Warning: Test: "@short_description" parameter unexpected at this location: + * @short_description: the application class + ^</message> + </messages> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * The application class handles ... + */</output> +</test> + +<test> + <!-- + Broken comment block with description part before parameters part, with empty line. + --> + <input>/** + * SECTION:meepapp + * + * The application class handles ... + * + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:meepapp</name> + </identifier> + <parameters> + <parameter> + <name>short_description</name> + <description>the application class</description> + </parameter> + <parameter> + <name>title</name> + <description>Meep application</description> + </parameter> + <parameter> + <name>section_id</name> + </parameter> + <parameter> + <name>see_also</name> + <description>#MeepSettings</description> + </parameter> + <parameter> + <name>stability</name> + <description>Stable</description> + </parameter> + <parameter> + <name>include</name> + <description>meep/app.h</description> + </parameter> + <parameter> + <name>image</name> + <description>application.png</description> + </parameter> + </parameters> + <description>The application class handles ...</description> + </docblock> + <messages> + <message>6: Warning: Test: "@short_description" parameter unexpected at this location: + * @short_description: the application class + ^</message> + </messages> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * @title: Meep application + * @section_id: + * @see_also: #MeepSettings + * @stability: Stable + * @include: meep/app.h + * @image: application.png + * + * The application class handles ... + */</output> +</test> + +<test> + <!-- + Old style implicit returns. + https://bugzilla.gnome.org/show_bug.cgi?id=457077 + --> + <input>/** + * SECTION:tester + * @short_description: module for gtk-doc unit test + * + * This file contains non-sense code for the sole purpose of testing the docs. + * + * As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it + * returns nothing. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:tester</name> + </identifier> + <parameters> + <parameter> + <name>short_description</name> + <description>module for gtk-doc unit test</description> + </parameter> + </parameters> + <description>This file contains non-sense code for the sole purpose of testing the docs. + +As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it +returns nothing.</description> + </docblock> + </parser> + <output>/** + * SECTION:tester + * @short_description: module for gtk-doc unit test + * + * This file contains non-sense code for the sole purpose of testing the docs. + * + * As described in http://bugzilla.gnome.org/show_bug.cgi?id=457077 it + * returns nothing. + */</output> +</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..522f1fa8 --- /dev/null +++ b/tests/scanner/annotationparser/gi/identifier_symbol.xml @@ -0,0 +1,435 @@ +<?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> + </parser> + <output>/** + * test_symbol: + * + * test_symbol does something nifty. + */</output> +</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> + <output>/** + * test_symbol_unnecessary_colon: + * + * Unnecessary colon. + */</output> +</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> + <output>/** + * test_annotated_symbol: (skip) + * + * test_annotated_symbol does something nifty. + */</output> +</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> + <output>/** + * test_symbol_missing_colon: (skip) + * + * Missing colon will result in a warning. + */</output> +</test> + +<test> + <input>/** + * test_malformed_symbol: (skip): + * + * Malformed symbol identifier. + **/</input> + <parser> + <docblock> + <identifier> + <name>test_malformed_symbol</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <description>Malformed symbol identifier.</description> + </docblock> + </parser> + <output>/** + * test_malformed_symbol: (skip) + * + * Malformed symbol identifier. + */</output> +</test> + +<test> + <input>/** + * GtkWidget:test_property + * + * Some property. + **/</input> + <parser> + <docblock> + <identifier> + <name>GtkWidget:test_property</name> + </identifier> + <description>Some property.</description> + </docblock> + </parser> + <output>/** + * GtkWidget:test_property: + * + * Some property. + */</output> +</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> + <output>/** + * GtkWidget:test_property_unnecessary_colon: + * + * Unnecessary colon. + */</output> +</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> + <output>/** + * GtkWidget:test_annotated_property: (skip) + * + * Some annotated property. + */</output> +</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> + <output>/** + * GtkWidget:test_property_missing_colon: (skip) + * + * Missing colon will result in a warning. + */</output> +</test> + +<test> + <input>/** + * GtkWidget:test_malformed_property: (skip): + * + * Malformed property identifier. + **/</input> + <parser> + <docblock> + <identifier> + <name>GtkWidget:test_malformed_property</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <description>Malformed property identifier.</description> + </docblock> + </parser> + <output>/** + * GtkWidget:test_malformed_property: (skip) + * + * Malformed property identifier. + */</output> +</test> + +<test> + <input>/** + * GtkWidget::test_signal + * + * Some signal. + **/</input> + <parser> + <docblock> + <identifier> + <name>GtkWidget::test_signal</name> + </identifier> + <description>Some signal.</description> + </docblock> + </parser> + <output>/** + * GtkWidget::test_signal: + * + * Some signal. + */</output> +</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> + <output>/** + * GtkWidget::test_signal_unnecessary_colon: + * + * Unnecessary colon. + */</output> +</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> + <output>/** + * GtkWidget::test_annotated_signal: (skip) + * + * Some annotated signal. + */</output> +</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> + <output>/** + * GtkWidget::test_signal_missing_colon: (skip) + * + * Missing colon will result in a warning. + */</output> +</test> + +<test> + <input>/** + * GtkWidget::test_malformed_signal: (skip): + * + * Malformed signal identifier. + **/</input> + <parser> + <docblock> + <identifier> + <name>GtkWidget::test_malformed_signal</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <description>Malformed signal identifier.</description> + </docblock> + </parser> + <output>/** + * GtkWidget::test_malformed_signal: (skip) + * + * Malformed signal identifier. + */</output> +</test> + +<test> + <input>/** + * test_multiline_annotations_on_identifier: (skip) + * (foreign) + * @param1: (allow-none) (transfer full): first parameter + * + * Annotations spanning multiple lines are not valid + **/</input> + <parser> + <docblock> + <identifier> + <name>test_multiline_annotations_on_identifier</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>param1</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + <description>first parameter</description> + </parameter> + </parameters> + <description>(foreign) +Annotations spanning multiple lines are not valid</description> + </docblock> + <messages> + <message>3: Error: Test: ignoring invalid multiline annotation continuation: + * (foreign) + ^</message> + </messages> + </parser> + <output>/** + * test_multiline_annotations_on_identifier: (skip) + * @param1: (allow-none) (transfer full): first parameter + * + * (foreign) + * Annotations spanning multiple lines are not valid + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/parameter.xml b/tests/scanner/annotationparser/gi/parameter.xml new file mode 100644 index 00000000..43f97b3f --- /dev/null +++ b/tests/scanner/annotationparser/gi/parameter.xml @@ -0,0 +1,375 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * test_parameter_missing_colon: + * @param1: (allow-none) first parameter + * + * Forgotten colon above will result in a warning. + **/</input> + <parser> + <docblock> + <identifier> + <name>test_parameter_missing_colon</name> + </identifier> + <parameters> + <parameter> + <name>param1</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>first parameter</description> + </parameter> + </parameters> + <description>Forgotten colon above will result in a warning.</description> + </docblock> + <messages> + <message>3: Warning: Test: missing ":" at column 25: + * @param1: (allow-none) first parameter + ^</message> + </messages> + </parser> + <output>/** + * test_parameter_missing_colon: + * @param1: (allow-none): first parameter + * + * Forgotten colon above will result in a warning. + */</output> +</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> + <message>7: Warning: Test: "Returns:" tag unexpected at this location: + * Returns: something + ^</message> + </messages> + </parser> + <output>/** + * test_unexpected_parameter: + * @param1: first parameter + * + * Parameters should go before the comment block description. + * + * Returns: something + */</output> +</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: Error: Test: multiple "@param1" parameters for identifier "test_multiple_parameters": + * @param1: first parameter again + ^</message> + </messages> + </parser> + <output>/** + * test_multiple_parameters: + * @param1: first parameter again + */</output> +</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: Error: Test: ignoring invalid multiline annotation continuation: + * (transfer full): first parameter + ^</message> + </messages> + </parser> + <output>/** + * test_multiline_annotations_on_parameter: + * @param1: (allow-none): + * (transfer full): first parameter + * + * Annotations spanning multiple lines are not valid + */</output> +</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> + <output>/** + * 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 + */</output> +</test> + +<test> + <input>/** + * anjuta_async_notify_get_error: + * + * @self: An #AnjutaAsyncNotify object + * @error: Return location for the error set by the called interface to which + * this object was passed. If no error is set, @error is set to NULL. + * + * Gets the error set on @self. + */</input> + <parser> + <docblock> + <identifier> + <name>anjuta_async_notify_get_error</name> + </identifier> + <parameters> + <parameter> + <name>self</name> + <description>An #AnjutaAsyncNotify object</description> + </parameter> + <parameter> + <name>error</name> + <description>Return location for the error set by the called interface to which + this object was passed. If no error is set, @error is set to NULL.</description> + </parameter> + </parameters> + <description>Gets the error set on @self.</description> + </docblock> + <messages> + <message>4: Warning: Test: "@self" parameter unexpected at this location: + * @self: An #AnjutaAsyncNotify object + ^</message> + </messages> + </parser> + <output>/** + * anjuta_async_notify_get_error: + * @self: An #AnjutaAsyncNotify object + * @error: Return location for the error set by the called interface to which + * this object was passed. If no error is set, @error is set to NULL. + * + * Gets the error set on @self. + */</output> +</test> + +<test> + <input> /** + * GtkPrintOperation::done + * @operation: the #GtkPrintOperation on which the signal was emitted + * @result: the result of the print operation + * + * Emitted when the print operation run has finished doing + * everything required for printing. + * + * @result gives you information about what happened during the run. + * If @result is %GTK_PRINT_OPERATION_RESULT_ERROR then you can call + * gtk_print_operation_get_error() for more information. + * + * If you enabled print status tracking then + * gtk_print_operation_is_finished() may still return %FALSE + * after #GtkPrintOperation::done was emitted. + * + * Since: 2.10 + */</input> + <parser> + <docblock> + <identifier> + <name>GtkPrintOperation::done</name> + </identifier> + <parameters> + <parameter> + <name>operation</name> + <description>the #GtkPrintOperation on which the signal was emitted</description> + </parameter> + <parameter> + <name>result</name> + <description>the result of the print operation</description> + </parameter> + </parameters> + <description>Emitted when the print operation run has finished doing +everything required for printing. + +@result gives you information about what happened during the run. +If @result is %GTK_PRINT_OPERATION_RESULT_ERROR then you can call +gtk_print_operation_get_error() for more information. + +If you enabled print status tracking then +gtk_print_operation_is_finished() may still return %FALSE +after #GtkPrintOperation::done was emitted.</description> + <tags> + <tag> + <name>since</name> + <value>2.10</value> + </tag> + </tags> + </docblock> + </parser> + <output> /** + * GtkPrintOperation::done: + * @operation: the #GtkPrintOperation on which the signal was emitted + * @result: the result of the print operation + * + * Emitted when the print operation run has finished doing + * everything required for printing. + * + * @result gives you information about what happened during the run. + * If @result is %GTK_PRINT_OPERATION_RESULT_ERROR then you can call + * gtk_print_operation_get_error() for more information. + * + * If you enabled print status tracking then + * gtk_print_operation_is_finished() may still return %FALSE + * after #GtkPrintOperation::done was emitted. + * + * Since: 2.10 + */</output> +</test> + +<test> + <input>/** + * TrackerDirectoryFlags: + * @TRACKER_DIRECTORY_FLAG_NONE: No flags. + * @TRACKER_DIRECTORY_FLAG_RECURSE: Should recurse in the directory. + * @TRACKER_DIRECTORY_FLAG_CHECK_MTIME: Should check mtimes of items in the directory. + * @TRACKER_DIRECTORY_FLAG_MONITOR: Should setup monitors in the items found in the directory. + * @TRACKER_DIRECTORY_FLAG_IGNORE: Should ignore the directory contents. + * @TRACKER_DIRECTORY_FLAG_PRESERVE: Should preserve items in the directory even if the directory gets removed. + * + * Flags used when adding a new directory to be indexed in the #TrackerIndexingTree. + */</input> + <parser> + <docblock> + <identifier> + <name>TrackerDirectoryFlags</name> + </identifier> + <parameters> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_NONE</name> + <description>No flags.</description> + </parameter> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_RECURSE</name> + <description>Should recurse in the directory.</description> + </parameter> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_CHECK_MTIME</name> + <description>Should check mtimes of items in the directory.</description> + </parameter> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_MONITOR</name> + <description>Should setup monitors in the items found in the directory.</description> + </parameter> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_IGNORE</name> + <description>Should ignore the directory contents.</description> + </parameter> + <parameter> + <name>TRACKER_DIRECTORY_FLAG_PRESERVE</name> + <description>Should preserve items in the directory even if the directory gets removed.</description> + </parameter> + </parameters> + <description>Flags used when adding a new directory to be indexed in the #TrackerIndexingTree.</description> + </docblock> + </parser> + <output>/** + * TrackerDirectoryFlags: + * @TRACKER_DIRECTORY_FLAG_NONE: No flags. + * @TRACKER_DIRECTORY_FLAG_RECURSE: Should recurse in the directory. + * @TRACKER_DIRECTORY_FLAG_CHECK_MTIME: Should check mtimes of items in the directory. + * @TRACKER_DIRECTORY_FLAG_MONITOR: Should setup monitors in the items found in the directory. + * @TRACKER_DIRECTORY_FLAG_IGNORE: Should ignore the directory contents. + * @TRACKER_DIRECTORY_FLAG_PRESERVE: Should preserve items in the directory even if the directory gets removed. + * + * Flags used when adding a new directory to be indexed in the #TrackerIndexingTree. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/parameter_varargs.xml b/tests/scanner/annotationparser/gi/parameter_varargs.xml new file mode 100644 index 00000000..b22906de --- /dev/null +++ b/tests/scanner/annotationparser/gi/parameter_varargs.xml @@ -0,0 +1,298 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @...: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</input> + <parser> + <docblock> + <identifier> + <name>function_name</name> + </identifier> + <parameters> + <parameter> + <name>par1</name> + <description>description of parameter 1. These can extend over more than +one line.</description> + </parameter> + <parameter> + <name>par2</name> + <description>description of parameter 2</description> + </parameter> + <parameter> + <name>...</name> + <description>a %NULL-terminated list of bars</description> + </parameter> + </parameters> + <description>The function description goes here. You can use @par1 to refer to parameters +so that they are highlighted in the output. You can also use %constant +for constants, function_name2() for functions and #GtkWidget for links to +other declarations (which may be documented elsewhere).</description> + <tags> + <tag> + <name>returns</name> + <description>an integer.</description> + </tag> + <tag> + <name>since</name> + <value>2.2</value> + </tag> + <tag> + <name>deprecated</name> + <value>2.18</value> + <description>Use other_function() instead.</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @...: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</output> +</test> + +<test> + <!-- + gtkdoc-mkdb has deprecated named __VA_ARGS__ parameter notation. + But there is a gcc CPP extension that, for macros, makes it possible to give a more descriptive + name for the variable argument than simply __VA_ARGS__. See + http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html for more information. + Encountered in the wild in for example: + http://git.kernel.org/?p=bluetooth/bluez.git;a=blob;f=src/log.h;h=3d34fa3774e5400c030d29a264824fe0584de2a8;hb=HEAD#l44 + --> + <input>/** + * DBG: + * @fmt: format string + * @arg...: list of arguments + * + * Simple macro around btd_debug() which also include the function + * name it is called in. + */</input> + <parser> + <docblock> + <identifier> + <name>DBG</name> + </identifier> + <parameters> + <parameter> + <name>fmt</name> + <description>format string</description> + </parameter> + <parameter> + <name>...</name> + <description>list of arguments</description> + </parameter> + </parameters> + <description>Simple macro around btd_debug() which also include the function +name it is called in.</description> + </docblock> + <messages> + <message>4: Warning: Test: "@arg..." parameter is deprecated, please use "@..." instead: + * @arg...: list of arguments + ^</message> + </messages> + </parser> + <output>/** + * DBG: + * @fmt: format string + * @...: list of arguments + * + * Simple macro around btd_debug() which also include the function + * name it is called in. + */</output> +</test> + +<test> + <!-- + Deprecated @Vargargs parameter + --> + <input>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @Varargs: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</input> + <parser> + <docblock> + <identifier> + <name>function_name</name> + </identifier> + <parameters> + <parameter> + <name>par1</name> + <description>description of parameter 1. These can extend over more than +one line.</description> + </parameter> + <parameter> + <name>par2</name> + <description>description of parameter 2</description> + </parameter> + <parameter> + <name>...</name> + <description>a %NULL-terminated list of bars</description> + </parameter> + </parameters> + <description>The function description goes here. You can use @par1 to refer to parameters +so that they are highlighted in the output. You can also use %constant +for constants, function_name2() for functions and #GtkWidget for links to +other declarations (which may be documented elsewhere).</description> + <tags> + <tag> + <name>returns</name> + <description>an integer.</description> + </tag> + <tag> + <name>since</name> + <value>2.2</value> + </tag> + <tag> + <name>deprecated</name> + <value>2.18</value> + <description>Use other_function() instead.</description> + </tag> + </tags> + </docblock> + <messages> + <message>6: Warning: Test: "@Varargs" parameter is deprecated, please use "@..." instead: + * @Varargs: a %NULL-terminated list of bars + ^</message> + </messages> + </parser> + <output>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @...: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</output> +</test> + +<test> + <!-- + Normal @vargargs parameter (usually seen for va_list) + --> + <input>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @varargs: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</input> + <parser> + <docblock> + <identifier> + <name>function_name</name> + </identifier> + <parameters> + <parameter> + <name>par1</name> + <description>description of parameter 1. These can extend over more than +one line.</description> + </parameter> + <parameter> + <name>par2</name> + <description>description of parameter 2</description> + </parameter> + <parameter> + <name>varargs</name> + <description>a %NULL-terminated list of bars</description> + </parameter> + </parameters> + <description>The function description goes here. You can use @par1 to refer to parameters +so that they are highlighted in the output. You can also use %constant +for constants, function_name2() for functions and #GtkWidget for links to +other declarations (which may be documented elsewhere).</description> + <tags> + <tag> + <name>returns</name> + <description>an integer.</description> + </tag> + <tag> + <name>since</name> + <value>2.2</value> + </tag> + <tag> + <name>deprecated</name> + <value>2.18</value> + <description>Use other_function() instead.</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * function_name: + * @par1: description of parameter 1. These can extend over more than + * one line. + * @par2: description of parameter 2 + * @varargs: a %NULL-terminated list of bars + * + * The function description goes here. You can use @par1 to refer to parameters + * so that they are highlighted in the output. You can also use %constant + * for constants, function_name2() for functions and #GtkWidget for links to + * other declarations (which may be documented elsewhere). + * + * Returns: an integer. + * Since: 2.2 + * Deprecated: 2.18: Use other_function() instead. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax.xml b/tests/scanner/annotationparser/gi/syntax.xml new file mode 100644 index 00000000..d1841a35 --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax.xml @@ -0,0 +1,467 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <!-- + Not GTK-Doc + --> + <input>//Test</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>// Test</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/** +//</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/*Test*/</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/* Test */</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/* Test +something */</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/* +Test +something */</input> +</test> + +<test> + <!-- + Not GTK-Doc + --> + <input>/** +*/</input> +</test> + +<test> + <input>/** Test **/</input> + <parser> + <messages> + <message>1: Error: Test: Skipping invalid GTK-Doc comment block: +/** Test **/ +^</message> + </messages> + </parser> +</test> + +<test> + <input>/**Test +*/</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + </docblock> + <messages> + <message>1: Warning: Test: GTK-Doc comment block start token "/**" should not be followed by comment text: +/**Test + ^</message> + </messages> + </parser> + <output>/** + * Test: + */</output> +</test> + +<test> + <input>/** +Test */</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + </docblock> + <messages> + <message>2: Warning: Test: GTK-Doc comment block end token "*/" should not be preceded by comment text: +Test */ + ^</message> + </messages> + </parser> + <output>/** + * Test: + */</output> +</test> + +<test> + <input>/** Test +something */</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + <description>something</description> + </docblock> + <messages> + <message>1: Warning: Test: GTK-Doc comment block start token "/**" should not be followed by comment text: +/** Test + ^</message> + <message>2: Warning: Test: GTK-Doc comment block end token "*/" should not be preceded by comment text: +something */ + ^</message> + </messages> + </parser> + <output>/** + * Test: + * + * something + */</output> +</test> + +<test> + <input>/** +Test +something */</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + <description>something</description> + </docblock> + <messages> + <message>3: Warning: Test: GTK-Doc comment block end token "*/" should not be preceded by comment text: +something */ + ^</message> + </messages> + </parser> + <output>/** + * Test: + * + * something + */</output> +</test> + +<test> + <input>/** +Test +something **/</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + <description>something</description> + </docblock> + <messages> + <message>3: Warning: Test: GTK-Doc comment block end token "*/" should not be preceded by comment text: +something **/ + ^</message> + </messages> + </parser> + <output>/** + * Test: + * + * something + */</output> +</test> + +<test> + <input>code goes here /** Test +something */ code goes here</input> + <parser> + <docblock> + <identifier> + <name>Test</name> + </identifier> + <description>something</description> + </docblock> + <messages> + <message>1: Warning: Test: GTK-Doc comment block start token "/**" should not be preceded by code: +code goes here /** Test + ^</message> + <message>1: Warning: Test: GTK-Doc comment block start token "/**" should not be followed by comment text: +code goes here /** Test + ^</message> + <message>2: Warning: Test: GTK-Doc comment block end token "*/" should not be followed by code: +something */ code goes here + ^</message> + <message>2: Warning: Test: GTK-Doc comment block end token "*/" should not be preceded by comment text: +something */ code goes here + ^</message> + </messages> + </parser> + <output><![CDATA[code goes here +/** + * Test: + * + * something + */ + code goes here]]></output> +</test> + +<test> + <!-- + Malformed comment block, signal the start of the comment block description followed + by a parameter instead. + --> + <input>/** + * SECTION:meepapp + * + * @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>The application class handles ...</description> + </docblock> + <messages> + <message>4: Warning: Test: "@short_description" parameter unexpected at this location: + * @short_description: the application class + ^</message> + </messages> + </parser> + <output>/** + * SECTION:meepapp + * @short_description: the application class + * + * The application class handles ... + */</output> +</test> + +<test> + <!-- + identifier not on the first line. + --> + <input>/** + + * + + * regress_test_invalid_comment: + * @foo: a param + + * comment having lines without ' * ' + * https://bugzilla.gnome.org/show_bug.cgi?id=673806 + */</input> + <parser> + <docblock> + <identifier> + <name>regress_test_invalid_comment</name> + </identifier> + <parameters> + <parameter> + <name>foo</name> + <description>a param</description> + </parameter> + </parameters> + <description>comment having lines without ' * ' +https://bugzilla.gnome.org/show_bug.cgi?id=673806</description> + </docblock> + <messages> + <message>2: Error: Test: identifier not found on the first line: + +^</message> + </messages> + </parser> + <output>/** + * regress_test_invalid_comment: + * @foo: a param + * + * comment having lines without ' * ' + * https://bugzilla.gnome.org/show_bug.cgi?id=673806 + */</output> +</test> + +<test> + <!-- Confusing but well formed mixing of lines starting with and without * --> + <input>/** + * atk_hyperlink_is_inline: + * @link_: an #AtkHyperlink + * + * Indicates whether the link currently displays some or all of its + * content inline. Ordinary HTML links will usually return + * %FALSE, but an inline <src> HTML element will return + * %TRUE. + a * + * Returns: whether or not this link displays its content inline. + * + **/</input> + <parser> + <docblock> + <identifier> + <name>atk_hyperlink_is_inline</name> + </identifier> + <parameters> + <parameter> + <name>link_</name> + <description>an #AtkHyperlink</description> + </parameter> + </parameters> + <description>Indicates whether the link currently displays some or all of its + content inline. Ordinary HTML links will usually return + %FALSE, but an inline <src> HTML element will return + %TRUE.</description> + <tags> + <tag> + <name>returns</name> + <description>whether or not this link displays its content inline.</description> + </tag> + </tags> + </docblock> + <messages> + <message>9: Error: Test: invalid comment text: + a * + ^</message> + </messages> + </parser> + <output>/** + * atk_hyperlink_is_inline: + * @link_: an #AtkHyperlink + * + * Indicates whether the link currently displays some or all of its + * content inline. Ordinary HTML links will usually return + * %FALSE, but an inline <src> HTML element will return + * %TRUE. + * + * Returns: whether or not this link displays its content inline. + */</output> +</test> + +<test> + <input>/** + * gtk_tooltip_set_custom: + * + * Replaces the widget packed into the tooltip with + * @custom_widget. @custom_widget does not get destroyed when the tooltip goes + * away. + * By default a box with a #GtkImage and #GtkLabel is embedded in + * the tooltip, which can be configured using gtk_tooltip_set_markup() + * and gtk_tooltip_set_icon(). + + * + * Since: 2.12 + */</input> + <parser> + <docblock> + <identifier> + <name>gtk_tooltip_set_custom</name> + </identifier> + <description>Replaces the widget packed into the tooltip with +@custom_widget. @custom_widget does not get destroyed when the tooltip goes +away. +By default a box with a #GtkImage and #GtkLabel is embedded in +the tooltip, which can be configured using gtk_tooltip_set_markup() +and gtk_tooltip_set_icon().</description> + <tags> + <tag> + <name>since</name> + <value>2.12</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * gtk_tooltip_set_custom: + * + * Replaces the widget packed into the tooltip with + * @custom_widget. @custom_widget does not get destroyed when the tooltip goes + * away. + * By default a box with a #GtkImage and #GtkLabel is embedded in + * the tooltip, which can be configured using gtk_tooltip_set_markup() + * and gtk_tooltip_set_icon(). + * + * Since: 2.12 + */</output> +</test> + +<test> + <input>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * Return: the position of the character + */</input> + <parser> + <docblock> + <identifier> + <name>clutter_text_coords_to_position</name> + </identifier> + <parameters> + <parameter> + <name>self</name> + <description>a #ClutterText</description> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <description>the position of the character</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * + * Returns: the position of the character + */</output> +</test> + +<test> + <input>/** + * clutter_text_coords_to_position: + * Return: the position of the character + */</input> + <parser> + <docblock> + <identifier> + <name>clutter_text_coords_to_position</name> + </identifier> + <tags> + <tag> + <name>returns</name> + <description>the position of the character</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * clutter_text_coords_to_position: + * + * Returns: the position of the character + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax_indentation.xml b/tests/scanner/annotationparser/gi/syntax_indentation.xml new file mode 100644 index 00000000..1b8c6324 --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax_indentation.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input> /** + * SECTION:test + * + * Describe section here + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>Describe section here</description> + </docblock> + </parser> + <output> /** + * SECTION:test + * + * Describe section here + */</output> +</test> + +<test> + <input> /** + * SECTION:test + * + * Describe section here + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>Describe section here</description> + </docblock> + </parser> + <output> /** + * SECTION:test + * + * Describe section here + */</output> +</test> + +<test> + <input> /** + * SECTION:test + * + * Describe section here + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>Describe section here</description> + </docblock> + </parser> + <output> /** + * SECTION:test + * + * Describe section here + */</output> +</test> + +<test> + <input> /** + * SECTION:test + * + * Describe section here + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>Describe section here</description> + </docblock> + </parser> + <output indent="false">/** + * SECTION:test + * + * Describe section here + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml b/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml new file mode 100644 index 00000000..4aa92e42 --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax_multiline_annotations.xml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * regress_forced_method: (skip) + * (method) + * @obj: A #RegressTestObj + */</input> + <parser> + <docblock> + <identifier> + <name>regress_forced_method</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>obj</name> + <description>A #RegressTestObj</description> + </parameter> + </parameters> + <description>(method)</description> + </docblock> + <messages> + <message>3: Error: Test: ignoring invalid multiline annotation continuation: + * (method) + ^</message> + </messages> + </parser> + <output>/** + * regress_forced_method: (skip) + * @obj: A #RegressTestObj + * + * (method) + */</output> +</test> + +<test> + <input>/** + * regress_forced_method: (skip) + * (method) + * @obj: A #RegressTestObj + */</input> + <parser> + <docblock> + <identifier> + <name>regress_forced_method</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </identifier> + <parameters> + <parameter> + <name>obj</name> + <description>A #RegressTestObj</description> + </parameter> + </parameters> + <description>(method)</description> + </docblock> + <messages> + <message>3: Error: Test: ignoring invalid multiline annotation continuation: + * (method) + ^</message> + </messages> + </parser> + <output>/** + * regress_forced_method: (skip) + * @obj: A #RegressTestObj + * + * (method) + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax_nested_tags.xml b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml new file mode 100644 index 00000000..11b5a674 --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax_nested_tags.xml @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <!-- + Well, not really nested tags as the Since: 2.30 is considered to be part of the + description of the @G_APPLICATION_NON_UNIQUE parameter. + --> + <input>/** + * GApplicationFlags: + * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical + * single-instance application negotiation, even if the application + * ID is given. The application neither attempts to become the + * owner of the application ID nor does it check if an existing + * owner already exists. Everything occurs in the local process. + * Since: 2.30. + * + * Flags used to define the behaviour of a #GApplication. + * + * Since: 2.28 + **/</input> + <parser> + <docblock> + <identifier> + <name>GApplicationFlags</name> + </identifier> + <parameters> + <parameter> + <name>G_APPLICATION_NON_UNIQUE</name> + <description>Make no attempts to do any of the typical + single-instance application negotiation, even if the application + ID is given. The application neither attempts to become the + owner of the application ID nor does it check if an existing + owner already exists. Everything occurs in the local process. + Since: 2.30.</description> + </parameter> + </parameters> + <description>Flags used to define the behaviour of a #GApplication.</description> + <tags> + <tag> + <name>since</name> + <value>2.28</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * GApplicationFlags: + * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical + * single-instance application negotiation, even if the application + * ID is given. The application neither attempts to become the + * owner of the application ID nor does it check if an existing + * owner already exists. Everything occurs in the local process. + * Since: 2.30. + * + * Flags used to define the behaviour of a #GApplication. + * + * Since: 2.28 + */</output> +</test> + +<test> + <input><![CDATA[/** + * GSourceFuncs: + * @prepare: Called before all the file descriptors are polled. If the + * source can determine that it is ready here (without waiting for the + * results of the poll() call) it should return %TRUE. It can also return + * a @timeout_ value which should be the maximum timeout (in milliseconds) + * which should be passed to the poll() call. The actual timeout used will + * be -1 if all sources returned -1, or it will be the minimum of all the + * @timeout_ values returned which were >= 0. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always + * returns %FALSE with a timeout of -1. If @prepare returns a + * timeout and the source also has a 'ready time' set then the + * nearer of the two will be used. + * @check: Called after all the file descriptors are polled. The source + * should return %TRUE if it is ready to be dispatched. Note that some + * time may have passed since the previous prepare function was called, + * so the source should be checked again here. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always + * returns %FALSE. + * @dispatch: Called to dispatch the event source, after it has returned + * %TRUE in either its @prepare or its @check function. The @dispatch + * function is passed in a callback function and data. The callback + * function may be %NULL if the source was never connected to a callback + * using g_source_set_callback(). The @dispatch function should call the + * callback function with @user_data and whatever additional parameters + * are needed for this type of event source. + * @finalize: Called when the source is finalized. + * + * The <structname>GSourceFuncs</structname> struct contains a table of + * functions used to handle event sources in a generic manner. + * + * For idle sources, the prepare and check functions always return %TRUE + * to indicate that the source is always ready to be processed. The prepare + * function also returns a timeout value of 0 to ensure that the poll() call + * doesn't block (since that would be time wasted which could have been spent + * running the idle function). + * + * For timeout sources, the prepare and check functions both return %TRUE + * if the timeout interval has expired. The prepare function also returns + * a timeout value to ensure that the poll() call doesn't block too long + * and miss the next timeout. + * + * For file descriptor sources, the prepare function typically returns %FALSE, + * since it must wait until poll() has been called before it knows whether + * any events need to be processed. It sets the returned timeout to -1 to + * indicate that it doesn't mind how long the poll() call blocks. In the + * check function, it tests the results of the poll() call to see if the + * required condition has been met, and returns %TRUE if so. + */]]></input> + <parser> + <docblock> + <identifier> + <name>GSourceFuncs</name> + </identifier> + <parameters> + <parameter> + <name>prepare</name> + <description>Called before all the file descriptors are polled. If the + source can determine that it is ready here (without waiting for the + results of the poll() call) it should return %TRUE. It can also return + a @timeout_ value which should be the maximum timeout (in milliseconds) + which should be passed to the poll() call. The actual timeout used will + be -1 if all sources returned -1, or it will be the minimum of all the + @timeout_ values returned which were >= 0. Since 2.36 this may + be %NULL, in which case the effect is as if the function always + returns %FALSE with a timeout of -1. If @prepare returns a + timeout and the source also has a 'ready time' set then the + nearer of the two will be used.</description> + </parameter> + <parameter> + <name>check</name> + <description>Called after all the file descriptors are polled. The source + should return %TRUE if it is ready to be dispatched. Note that some + time may have passed since the previous prepare function was called, + so the source should be checked again here. Since 2.36 this may + be %NULL, in which case the effect is as if the function always + returns %FALSE.</description> + </parameter> + <parameter> + <name>dispatch</name> + <description>Called to dispatch the event source, after it has returned + %TRUE in either its @prepare or its @check function. The @dispatch + function is passed in a callback function and data. The callback + function may be %NULL if the source was never connected to a callback + using g_source_set_callback(). The @dispatch function should call the + callback function with @user_data and whatever additional parameters + are needed for this type of event source.</description> + </parameter> + <parameter> + <name>finalize</name> + <description>Called when the source is finalized.</description> + </parameter> + </parameters> + <description><![CDATA[The <structname>GSourceFuncs</structname> struct contains a table of +functions used to handle event sources in a generic manner. + +For idle sources, the prepare and check functions always return %TRUE +to indicate that the source is always ready to be processed. The prepare +function also returns a timeout value of 0 to ensure that the poll() call +doesn't block (since that would be time wasted which could have been spent +running the idle function). + +For timeout sources, the prepare and check functions both return %TRUE +if the timeout interval has expired. The prepare function also returns +a timeout value to ensure that the poll() call doesn't block too long +and miss the next timeout. + +For file descriptor sources, the prepare function typically returns %FALSE, +since it must wait until poll() has been called before it knows whether +any events need to be processed. It sets the returned timeout to -1 to +indicate that it doesn't mind how long the poll() call blocks. In the +check function, it tests the results of the poll() call to see if the +required condition has been met, and returns %TRUE if so.]]></description> + </docblock> + </parser> + <output><![CDATA[/** + * GSourceFuncs: + * @prepare: Called before all the file descriptors are polled. If the + * source can determine that it is ready here (without waiting for the + * results of the poll() call) it should return %TRUE. It can also return + * a @timeout_ value which should be the maximum timeout (in milliseconds) + * which should be passed to the poll() call. The actual timeout used will + * be -1 if all sources returned -1, or it will be the minimum of all the + * @timeout_ values returned which were >= 0. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always + * returns %FALSE with a timeout of -1. If @prepare returns a + * timeout and the source also has a 'ready time' set then the + * nearer of the two will be used. + * @check: Called after all the file descriptors are polled. The source + * should return %TRUE if it is ready to be dispatched. Note that some + * time may have passed since the previous prepare function was called, + * so the source should be checked again here. Since 2.36 this may + * be %NULL, in which case the effect is as if the function always + * returns %FALSE. + * @dispatch: Called to dispatch the event source, after it has returned + * %TRUE in either its @prepare or its @check function. The @dispatch + * function is passed in a callback function and data. The callback + * function may be %NULL if the source was never connected to a callback + * using g_source_set_callback(). The @dispatch function should call the + * callback function with @user_data and whatever additional parameters + * are needed for this type of event source. + * @finalize: Called when the source is finalized. + * + * The <structname>GSourceFuncs</structname> struct contains a table of + * functions used to handle event sources in a generic manner. + * + * For idle sources, the prepare and check functions always return %TRUE + * to indicate that the source is always ready to be processed. The prepare + * function also returns a timeout value of 0 to ensure that the poll() call + * doesn't block (since that would be time wasted which could have been spent + * running the idle function). + * + * For timeout sources, the prepare and check functions both return %TRUE + * if the timeout interval has expired. The prepare function also returns + * a timeout value to ensure that the poll() call doesn't block too long + * and miss the next timeout. + * + * For file descriptor sources, the prepare function typically returns %FALSE, + * since it must wait until poll() has been called before it knows whether + * any events need to be processed. It sets the returned timeout to -1 to + * indicate that it doesn't mind how long the poll() call blocks. In the + * check function, it tests the results of the poll() call to see if the + * required condition has been met, and returns %TRUE if so. + */]]></output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml new file mode 100644 index 00000000..77cabf0e --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax_paragraph_breaks.xml @@ -0,0 +1,359 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <!-- + All lines (outside program- listings and CDATA sections) just containing + a ' *' (blank-asterisk) are converted to paragraph breaks. + --> + <input>/** + * SECTION:test + * + * The following line is ' *' (blank-asterisk). + * + * So this is considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is ' *' (blank-asterisk). + +So this is considered a new paragraph.</description> + </docblock> + </parser> + <output>/** + * SECTION:test + * + * The following line is ' *' (blank-asterisk). + * + * So this is considered a new paragraph. + */</output> +</test> + +<test> + <!-- + Description: tag, all lines (outside program- listings and CDATA sections) just containing + a ' *' (blank-asterisk) are converted to paragraph breaks. + --> + <input>/** + * SECTION:test + * + * Description: The following line is ' *' (blank-asterisk). + * + * So this is considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is ' *' (blank-asterisk). + +So this is considered a new paragraph.</description> + </docblock> + <messages> + <message>4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: The following line is ' *' (blank-asterisk). + ^</message> + </messages> + </parser> + <output>/** + * SECTION:test + * + * The following line is ' *' (blank-asterisk). + * + * So this is considered a new paragraph. + */</output> +</test> + +<test> + <!-- + ' * ' (blank-asterisk-blank) are also converted to paragraph breaks. + --> + <input>/** + * SECTION:test + * + * The following line is ' * ' (blank-asterisk-blank). + * + * So this is considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is ' * ' (blank-asterisk-blank). + +So this is considered a new paragraph.</description> + </docblock> + </parser> + <output>/** + * SECTION:test + * + * The following line is ' * ' (blank-asterisk-blank). + * + * So this is considered a new paragraph. + */</output> +</test> + +<test> + <!-- + Description: tag, ' * ' (blank-asterisk-blank) are also converted to paragraph breaks. + --> + <input>/** + * SECTION:test + * + * Description: The following line is ' * ' (blank-asterisk-blank). + * + * So this is considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is ' * ' (blank-asterisk-blank). + +So this is considered a new paragraph.</description> + </docblock> + <messages> + <message>4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: The following line is ' * ' (blank-asterisk-blank). + ^</message> + </messages> + </parser> + <output>/** + * SECTION:test + * + * The following line is ' * ' (blank-asterisk-blank). + * + * So this is considered a new paragraph. + */</output> +</test> + +<test> + <!-- + If you want an "empty line" but not a paragraph break, change that into ' * ' + (blank-asterisk-blank-blank). The "empty line" can be easily recognized in the + output as it contains a single space character. + --> + <input>/** + * SECTION:test + * + * The following line is (blank-asterisk-blank-blank). + * + * So this is preceded by an empty line and is not considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is (blank-asterisk-blank-blank). + +So this is preceded by an empty line and is not considered a new paragraph.</description> + </docblock> + </parser> + <output>/** + * SECTION:test + * + * The following line is (blank-asterisk-blank-blank). + * + * So this is preceded by an empty line and is not considered a new paragraph. + */</output> +</test> + +<test> + <!-- + Description: tag, if you want an "empty line" but not a paragraph break, change that into ' * ' + (blank-asterisk-blank-blank). The "empty line" can be easily recognized in the + output as it contains a single space character. + --> + <input>/** + * SECTION:test + * + * Description: The following line is (blank-asterisk-blank-blank). + * + * So this is preceded by an empty line and is not considered a new paragraph. + */</input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description>The following line is (blank-asterisk-blank-blank). + +So this is preceded by an empty line and is not considered a new paragraph.</description> + </docblock> + <messages> + <message>4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: The following line is (blank-asterisk-blank-blank). + ^</message> + </messages> + </parser> + <output>/** + * SECTION:test + * + * The following line is (blank-asterisk-blank-blank). + * + * So this is preceded by an empty line and is not considered a new paragraph. + */</output> +</test> + +<test> + <!-- + If you want an "empty line" but not a paragraph break, change that into ' * ' + (blank-asterisk-blank-blank). The "empty line" can be easily recognized in the + output as it contains a single space character. + --> + <input><![CDATA[/** + * SECTION:test + * + * <example> + * <title>Iterating over attributes</title> + * <programlisting> + * void + * print_attributes (GIBaseInfo *info) + * { + * GIAttributeIter iter = { 0, }; + * char *name; + * char *value; + * + * while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + * { + * g_print ("attribute name: %s value: %s", name, value); + * } + * } + * </programlisting> + * </example> + */]]></input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description><![CDATA[<example> +<title>Iterating over attributes</title> +<programlisting> +void +print_attributes (GIBaseInfo *info) +{ + GIAttributeIter iter = { 0, }; + char *name; + char *value; + + while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + { + g_print ("attribute name: %s value: %s", name, value); + } +} +</programlisting> +</example>]]></description> + </docblock> + </parser> + <output><![CDATA[/** + * SECTION:test + * + * <example> + * <title>Iterating over attributes</title> + * <programlisting> + * void + * print_attributes (GIBaseInfo *info) + * { + * GIAttributeIter iter = { 0, }; + * char *name; + * char *value; + * + * while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + * { + * g_print ("attribute name: %s value: %s", name, value); + * } + * } + * </programlisting> + * </example> + */]]></output> +</test> + +<test> + <!-- + Description: tag, if you want an "empty line" but not a paragraph break, change that into ' * ' + (blank-asterisk-blank-blank). The "empty line" can be easily recognized in the + output as it contains a single space character. + --> + <input><![CDATA[/** + * SECTION:test + * + * Description: <example> + * <title>Iterating over attributes</title> + * <programlisting> + * void + * print_attributes (GIBaseInfo *info) + * { + * GIAttributeIter iter = { 0, }; + * char *name; + * char *value; + * + * while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + * { + * g_print ("attribute name: %s value: %s", name, value); + * } + * } + * </programlisting> + * </example> + */]]></input> + <parser> + <docblock> + <identifier> + <name>SECTION:test</name> + </identifier> + <description><![CDATA[<example> +<title>Iterating over attributes</title> +<programlisting> +void +print_attributes (GIBaseInfo *info) +{ + GIAttributeIter iter = { 0, }; + char *name; + char *value; + + while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + { + g_print ("attribute name: %s value: %s", name, value); + } +} +</programlisting> +</example>]]></description> + </docblock> + <messages> + <message><![CDATA[4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: <example> + ^]]></message> + </messages> + </parser> + <output><![CDATA[/** + * SECTION:test + * + * <example> + * <title>Iterating over attributes</title> + * <programlisting> + * void + * print_attributes (GIBaseInfo *info) + * { + * GIAttributeIter iter = { 0, }; + * char *name; + * char *value; + * + * while (g_base_info_iterate_attributes (info, &iter, &name, &value)) + * { + * g_print ("attribute name: %s value: %s", name, value); + * } + * } + * </programlisting> + * </example> + */]]></output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/syntax_whitespace.xml b/tests/scanner/annotationparser/gi/syntax_whitespace.xml new file mode 100644 index 00000000..3857ea64 --- /dev/null +++ b/tests/scanner/annotationparser/gi/syntax_whitespace.xml @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * whitespace_test: + * @object: (skip): + * + * A #AnnotationObject + * + * + * @func: The callback + * + * + * Test overriding via the "Rename To" annotation. + * + * + * Returns: nothing + * + * + */</input> + <parser> + <docblock> + <identifier> + <name>whitespace_test</name> + </identifier> + <parameters> + <parameter> + <name>object</name> + <annotations> + <annotation> + <name>skip</name> + </annotation> + </annotations> + </parameter> + <parameter> + <name>func</name> + <description>The callback</description> + </parameter> + </parameters> + <description>A #AnnotationObject + + + +Test overriding via the "Rename To" annotation.</description> + <tags> + <tag> + <name>returns</name> + <description>nothing</description> + </tag> + </tags> + </docblock> + <messages> + <message>8: Warning: Test: "@func" parameter unexpected at this location: + * @func: The callback + ^</message> + </messages> + </parser> + <output>/** + * whitespace_test: + * @object: (skip): + * @func: The callback + * + * A #AnnotationObject + * + * + * + * Test overriding via the "Rename To" annotation. + * + * Returns: nothing + */</output> +</test> + +<test> + <input>/** + *atk_text_get_default_attributes: + *@text: an #AtkText + * + *Creates ... + * + *Returns: (transfer full): an ... + */</input> + <parser> + <docblock> + <identifier> + <name>atk_text_get_default_attributes</name> + </identifier> + <parameters> + <parameter> + <name>text</name> + <description>an #AtkText</description> + </parameter> + </parameters> + <description>Creates ...</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + <description>an ...</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * atk_text_get_default_attributes: + * @text: an #AtkText + * + * Creates ... + * + * Returns: (transfer full): an ... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag.xml b/tests/scanner/annotationparser/gi/tag.xml new file mode 100644 index 00000000..8480d4b4 --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag.xml @@ -0,0 +1,401 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * test_tag_missing_colon: + * + * Forgotten colon below will result in a warning. + * + * Returns: (allow-none) return value + **/</input> + <parser> + <docblock> + <identifier> + <name>test_tag_missing_colon</name> + </identifier> + <description>Forgotten colon below will result in a warning.</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>return value</description> + </tag> + </tags> + </docblock> + <messages> + <message>6: Warning: Test: missing ":" at column 25: + * Returns: (allow-none) return value + ^</message> + </messages> + </parser> + <output>/** + * test_tag_missing_colon: + * + * Forgotten colon below will result in a warning. + * + * Returns: (allow-none): return value + */</output> +</test> + +<test> + <input>/** + * test_unexpected_tag: + * + * @param1: first parameter + * does something + * Returns: something + * returning something + * + * Probably intended as the comment block description part but in reality belongs to + * the "Returns:"" tag description field. + **/</input> + <parser> + <docblock> + <identifier> + <name>test_unexpected_tag</name> + </identifier> + <parameters> + <parameter> + <name>param1</name> + <description>first parameter +does something</description> + </parameter> + </parameters> + <tags> + <tag> + <name>returns</name> + <description>something +returning something + +Probably intended as the comment block description part but in reality belongs to +the "Returns:"" tag description field.</description> + </tag> + </tags> + </docblock> + <messages> + <message>4: Warning: Test: "@param1" parameter unexpected at this location: + * @param1: first parameter + ^</message> + </messages> + </parser> + <output>/** + * test_unexpected_tag: + * @param1: first parameter + * does something + * + * Returns: something + * returning something + * + * Probably intended as the comment block description part but in reality belongs to + * the "Returns:"" tag description field. + */</output> +</test> + +<test> + <input>/** + * test_unknown_tag: + * + * Foo: something + * + * Returns: True + * Moo: anything + **/</input> + <parser> + <docblock> + <identifier> + <name>test_unknown_tag</name> + </identifier> + <description>Foo: something</description> + <tags> + <tag> + <name>returns</name> + <description>True +Moo: anything</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * test_unknown_tag: + * + * Foo: something + * + * Returns: True + * Moo: anything + */</output> +</test> + +<test> + <input>/** + * test_multiline_tag: + * + * Returns: + * True + * Since: + * 1.0: yeah + */</input> + <parser> + <docblock> + <identifier> + <name>test_multiline_tag</name> + </identifier> + <tags> + <tag> + <name>returns</name> + <description>True</description> + </tag> + <tag> + <name>since</name> + <description>1.0: yeah</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * test_multiline_tag: + * + * Returns: True + * Since: 1.0: yeah + */</output> +</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: Error: Test: ignoring invalid multiline annotation continuation: + * (transfer full): something + ^</message> + </messages> + </parser> + <output>/** + * test_multiline_annotations_on_tag: + * + * Annotations spanning multiple lines are not valid + * + * Returns: (allow-none): + * (transfer full): something + */</output> +</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> + <output>/** + * 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. + */</output> +</test> + +<test> + <input>/** + * gdk_device_list_axes: + * @device: a pointer #GdkDevice + * + * Returns a #GList of #GdkAtom<!-- -->s, containing the labels for + * the axes that @device currently has. + * + * Returns: (transfer container) (element-type GdkAtom): + * A #GList of #GdkAtom<!-- -->s, free + * with g_list_free(). + * + * Since: 3.0 + **/</input> + <parser> + <docblock> + <identifier> + <name>gdk_device_list_axes</name> + </identifier> + <parameters> + <parameter> + <name>device</name> + <description>a pointer #GdkDevice</description> + </parameter> + </parameters> + <description>Returns a #GList of #GdkAtom<!-- -->s, containing the labels for +the axes that @device currently has.</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>transfer</name> + <options> + <option> + <name>container</name> + </option> + </options> + </annotation> + <annotation> + <name>element-type</name> + <options> + <option> + <name>GdkAtom</name> + </option> + </options> + </annotation> + </annotations> + <description> + A #GList of #GdkAtom<!-- -->s, free + with g_list_free().</description> + </tag> + <tag> + <name>since</name> + <value>3.0</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * gdk_device_list_axes: + * @device: a pointer #GdkDevice + * + * Returns a #GList of #GdkAtom<!-- -->s, containing the labels for + * the axes that @device currently has. + * + * Returns: (transfer container) (element-type GdkAtom): + * A #GList of #GdkAtom<!-- -->s, free + * with g_list_free(). + * Since: 3.0 + */</output> +</test> + +<test> + <input>/** + * FsSession:codec-preferences: + * + * Type: GLib.List(FsCodec) + * Transfer: full + * + * This is the current preferences list for the local codecs. It is + * set by the user to specify the codec options and priorities. The user may + * change its value with fs_session_set_codec_preferences() at any time + * during a session. It is a #GList of #FsCodec. + * The user must free this codec list using fs_codec_list_destroy() when done. + * + * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE + * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the + * payload type of the codec will be "reserved" and not be used by any + * dynamically assigned payload type. + */</input> + <parser> + <docblock> + <identifier> + <name>FsSession:codec-preferences</name> + <annotations> + <annotation> + <name>type</name> + <options> + <option> + <name>GLib.List(FsCodec)</name> + </option> + </options> + </annotation> + <annotation> + <name>transfer</name> + <options> + <option> + <name>full</name> + </option> + </options> + </annotation> + </annotations> + </identifier> + <description>This is the current preferences list for the local codecs. It is +set by the user to specify the codec options and priorities. The user may +change its value with fs_session_set_codec_preferences() at any time +during a session. It is a #GList of #FsCodec. +The user must free this codec list using fs_codec_list_destroy() when done. + +The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE +or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the +payload type of the codec will be "reserved" and not be used by any +dynamically assigned payload type.</description> + </docblock> + <messages> + <message>4: Warning: Test: GObject-Introspection specific GTK-Doc tag "Type" has been deprecated, please use annotations on the identifier instead: + * Type: GLib.List(FsCodec) + ^</message> + <message>5: Warning: Test: GObject-Introspection specific GTK-Doc tag "Transfer" has been deprecated, please use annotations on the identifier instead: + * Transfer: full + ^</message> + </messages> + </parser> + <output> /** + * FsSession:codec-preferences: (type GLib.List(FsCodec)) (transfer full) + * + * This is the current preferences list for the local codecs. It is + * set by the user to specify the codec options and priorities. The user may + * change its value with fs_session_set_codec_preferences() at any time + * during a session. It is a #GList of #FsCodec. + * The user must free this codec list using fs_codec_list_destroy() when done. + * + * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE + * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the + * payload type of the codec will be "reserved" and not be used by any + * dynamically assigned payload type. + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag_deprecated.xml b/tests/scanner/annotationparser/gi/tag_deprecated.xml new file mode 100644 index 00000000..f1e8ca60 --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag_deprecated.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_versioned: + * + * Deprecated: 0.6: Use something else instead + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>deprecated</name> + <value>0.6</value> + <description>Use something else instead</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Deprecated: 0.6: Use something else instead + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Deprecated: 0.6 + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>deprecated</name> + <value>0.6</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Deprecated: 0.6 + */</output> +</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> + <value>2.24</value> + </tag> + </tags> + </docblock> + <messages> + <message>6: Error: Test: annotations not supported for tag "Deprecated:".</message> + </messages> + </parser> + <output>/** + * test_tag_not_annotatable: + * + * Tags (except Returns:) don't have annotations + * + * Deprecated: 2.24 + */</output> +</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> + <value>2.0</value> + </tag> + </tags> + </docblock> + <messages> + <message>5: Error: Test: multiple "Deprecated:" tags for identifier "test_multiple_tags": + * Deprecated: 2.0 + ^</message> + </messages> + </parser> + <output>/** + * test_multiple_tags: + * + * Deprecated: 2.0 + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag_description.xml b/tests/scanner/annotationparser/gi/tag_description.xml new file mode 100644 index 00000000..3dff7f33 --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag_description.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * shiny_function: + * + * Description: This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + **/</input> + <parser> + <docblock> + <identifier> + <name>shiny_function</name> + </identifier> + <description>This is a callback with a 'closure' argument that is not named +'user_data' and hence has to be annotated.</description> + </docblock> + <messages> + <message>4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: This is a callback with a 'closure' argument that is not named + ^</message> + </messages> + </parser> + <output>/** + * shiny_function: + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + */</output> +</test> + +<test> + <input>/** + * shiny_function: + * Description: This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + **/</input> + <parser> + <docblock> + <identifier> + <name>shiny_function</name> + </identifier> + <description>This is a callback with a 'closure' argument that is not named +'user_data' and hence has to be annotated.</description> + </docblock> + <messages> + <message>3: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: This is a callback with a 'closure' argument that is not named + ^</message> + </messages> + </parser> + <output>/** + * shiny_function: + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + */</output> +</test> + +<test> + <input>/** + * shiny_function: + * + * Some description here, but also below... + * + * Description: This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + **/</input> + <parser> + <docblock> + <identifier> + <name>shiny_function</name> + </identifier> + <description>Some description here, but also below... + +This is a callback with a 'closure' argument that is not named +'user_data' and hence has to be annotated.</description> + </docblock> + <messages> + <message>6: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: This is a callback with a 'closure' argument that is not named + ^</message> + </messages> + </parser> + <output>/** + * shiny_function: + * + * Some description here, but also below... + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + */</output> +</test> + +<test> + <input>/** + * shiny_function: + * + * Description: This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + * + * etc... + **/</input> + <parser> + <docblock> + <identifier> + <name>shiny_function</name> + </identifier> + <description>This is a callback with a 'closure' argument that is not named +'user_data' and hence has to be annotated. + + etc...</description> + </docblock> + <messages> + <message>4: Warning: Test: GTK-Doc tag "Description:" has been deprecated: + * Description: This is a callback with a 'closure' argument that is not named + ^</message> + </messages> + </parser> + <output>/** + * shiny_function: + * + * This is a callback with a 'closure' argument that is not named + * 'user_data' and hence has to be annotated. + * + * etc... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml b/tests/scanner/annotationparser/gi/tag_returns.xml new file mode 100644 index 00000000..8ccfaa63 --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag_returns.xml @@ -0,0 +1,595 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (allow-none): some boolean + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>some boolean</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (allow-none): some boolean + */</output> +</test> + +<test> + <input>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (allow-none)): some boolean + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + </tag> + </tags> + </docblock> + <messages> + <message>6: Error: Test: unbalanced parentheses, annotations will be ignored: + * Returns: (allow-none)): some boolean + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: + */</output> +</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> + <tags> + <tag> + <name>returns</name> + <description>something + +Tags should go after the comment block description</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * test_unexpected_tag: + * @param1: first parameter + * + * Returns: something + * + * Tags should go after the comment block description + */</output> +</test> + +<test> + <!-- + Deprecated "Return value:" tag + --> + <input>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Return value: (allow-none): some boolean + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>some boolean</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (allow-none): some boolean + */</output> +</test> + +<test> + <!-- + Deprecated "@returns" as a parameter + --> + <input>/** + * annotation_object_string_out: + * @returns: (allow-none): some boolean + * + * Test returning a string as an out parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>allow-none</name> + </annotation> + </annotations> + <description>some boolean</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (allow-none): some boolean + */</output> +</test> + +<test> + <!-- + Variation of "@returns" as a parameter + --> + <input>/** + * annotation_object_string_out: + * @returns: (allow-none)): some boolean + * + * Test returning a string as an out parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + </tag> + </tags> + </docblock> + <messages> + <message>3: Error: Test: unbalanced parentheses, annotations will be ignored: + * @returns: (allow-none)): some boolean + ^</message> + </messages> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: + */</output> +</test> + +<test> + <!-- + Variation of "@returns" as a parameter + --> + <input>/** + * annotation_object_string_out: + * @returns: + * + * Test returning a string as an out parameter + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: + */</output> +</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: Error: Test: encountered multiple "Returns" parameters or tags for "test_multiple_returns_tag_and_parameter".</message> + </messages> + </parser> + <output>/** + * test_multiple_returns_tag_and_parameter: + * + * Multiple return value warnings are checked for when a returns + * parameter is encountered. + * + * Returns: something else + */</output> +</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: Error: Test: encountered multiple return value parameters or tags for "test_multiple_returns_tag_and_parameter".</message> + </messages> + </parser> + <output>/** + * test_multiple_returns_tag_and_parameter: + * + * Multiple return value warnings are checked for when a returns + * parameter is encountered. + * + * Returns: something else + */</output> +</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: Error: Test: encountered multiple return value parameters or tags for "test_multiple_returns_tag_and_parameter".</message> + </messages> + </parser> + <output>/** + * test_multiple_returns_tag_and_parameter: + * + * Multiple return value warnings are checked for when a returns + * parameter is encountered. + * + * Returns: something else + */</output> +</test> + +<test> + <input><![CDATA[/** + * gtk_rc_get_im_module_path: + * @returns: a newly-allocated string containing the path in which to + * look for IM modules. + * + * Obtains the path in which to look for IM modules. See the documentation + * of the <link linkend="im-module-path"><envar>GTK_PATH</envar></link> + * environment variable for more details about looking up modules. This + * function is useful solely for utilities supplied with GTK+ and should + * not be used by applications under normal circumstances. + */]]></input> + <parser> + <docblock> + <identifier> + <name>gtk_rc_get_im_module_path</name> + </identifier> + <description><![CDATA[Obtains the path in which to look for IM modules. See the documentation +of the <link linkend="im-module-path"><envar>GTK_PATH</envar></link> +environment variable for more details about looking up modules. This +function is useful solely for utilities supplied with GTK+ and should +not be used by applications under normal circumstances.]]></description> + <tags> + <tag> + <name>returns</name> + <description>a newly-allocated string containing the path in which to + look for IM modules.</description> + </tag> + </tags> + </docblock> + </parser> + <output><![CDATA[/** + * gtk_rc_get_im_module_path: + * + * Obtains the path in which to look for IM modules. See the documentation + * of the <link linkend="im-module-path"><envar>GTK_PATH</envar></link> + * environment variable for more details about looking up modules. This + * function is useful solely for utilities supplied with GTK+ and should + * not be used by applications under normal circumstances. + * + * Returns: a newly-allocated string containing the path in which to + * look for IM modules. + */]]></output> +</test> + +<test> + <!-- + Technically not a valid Returns: tag, but we need to support this for backwards compatibility + with the old annotationparser. + --> + <input>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * @x: the X coordinate, relative to the actor + * @y: the Y coordinate, relative to the actor + * + * Retrieves the position of the character at the given coordinates. + * + * Return: the position of the character + * + * Since: 1.10 + */</input> + <parser> + <docblock> + <identifier> + <name>clutter_text_coords_to_position</name> + </identifier> + <parameters> + <parameter> + <name>self</name> + <description>a #ClutterText</description> + </parameter> + <parameter> + <name>x</name> + <description>the X coordinate, relative to the actor</description> + </parameter> + <parameter> + <name>y</name> + <description>the Y coordinate, relative to the actor</description> + </parameter> + </parameters> + <description>Retrieves the position of the character at the given coordinates.</description> + <tags> + <tag> + <name>returns</name> + <description>the position of the character</description> + </tag> + <tag> + <name>since</name> + <value>1.10</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * @x: the X coordinate, relative to the actor + * @y: the Y coordinate, relative to the actor + * + * Retrieves the position of the character at the given coordinates. + * + * Returns: the position of the character + * Since: 1.10 + */</output> +</test> + +<test> + <!-- + Technically not a valid Returns: tag, but we need to support this for backwards compatibility + with the old annotationparser. + --> + <input>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * @x: the X coordinate, relative to the actor + * @y: the Y coordinate, relative to the actor + * + * Retrieves the position of the character at the given coordinates. + * + * Returns value: the position of the character + * + * Since: 1.10 + */</input> + <parser> + <docblock> + <identifier> + <name>clutter_text_coords_to_position</name> + </identifier> + <parameters> + <parameter> + <name>self</name> + <description>a #ClutterText</description> + </parameter> + <parameter> + <name>x</name> + <description>the X coordinate, relative to the actor</description> + </parameter> + <parameter> + <name>y</name> + <description>the Y coordinate, relative to the actor</description> + </parameter> + </parameters> + <description>Retrieves the position of the character at the given coordinates.</description> + <tags> + <tag> + <name>returns</name> + <description>the position of the character</description> + </tag> + <tag> + <name>since</name> + <value>1.10</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * clutter_text_coords_to_position: + * @self: a #ClutterText + * @x: the X coordinate, relative to the actor + * @y: the Y coordinate, relative to the actor + * + * Retrieves the position of the character at the given coordinates. + * + * Returns: the position of the character + * Since: 1.10 + */</output> +</test> + +<test> + <input>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (out): some boolean + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_object_string_out</name> + </identifier> + <description>Test returning a string as an out parameter</description> + <tags> + <tag> + <name>returns</name> + <annotations> + <annotation> + <name>out</name> + </annotation> + </annotations> + <description>some boolean</description> + </tag> + </tags> + </docblock> + <messages> + <message>6: Warning: Test: unexpected annotation: out</message> + </messages> + </parser> + <output>/** + * annotation_object_string_out: + * + * Test returning a string as an out parameter + * + * Returns: (out): some boolean + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag_since.xml b/tests/scanner/annotationparser/gi/tag_since.xml new file mode 100644 index 00000000..06116aa1 --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag_since.xml @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_versioned: + * + * Since: 0.6 + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>since</name> + <value>0.6</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Since: 0.6 + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Since: (invalid)): 0.6 + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>since</name> + </tag> + </tags> + </docblock> + <messages> + <message>4: Error: Test: unbalanced parentheses, annotations will be ignored: + * Since: (invalid)): 0.6 + ^</message> + </messages> + </parser> + <output>/** + * annotation_versioned: + * + * Since: + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Since: this function is available since version 0.6 + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>since</name> + <description>this function is available since version 0.6</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Since: this function is available since version 0.6 + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Since: 0.6: this function is available since version 0.6 + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>since</name> + <value>0.6</value> + <description>this function is available since version 0.6</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Since: 0.6: this function is available since version 0.6 + */</output> +</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> + <value>2.24</value> + </tag> + </tags> + </docblock> + <messages> + <message>6: Error: Test: annotations not supported for tag "Since:".</message> + </messages> + </parser> + <output>/** + * test_tag_not_annotatable: + * + * Tags (except Returns:) don't have annotations + * + * Since: 2.24 + */</output> +</test> + +<test> + <!-- + Multiple "Since:" tags + --> + <input>/** + * test_multiple_tags: + * + * Since: 3.0 + * Since: 2.0: one of these "Since:" + * tags is wrong... + **/</input> + <parser> + <docblock> + <identifier> + <name>test_multiple_tags</name> + </identifier> + <tags> + <tag> + <name>since</name> + <value>2.0</value> + <description>one of these "Since:" +tags is wrong...</description> + </tag> + </tags> + </docblock> + <messages> + <message>5: Error: Test: multiple "Since:" tags for identifier "test_multiple_tags": + * Since: 2.0: one of these "Since:" + ^</message> + </messages> + </parser> + <output>/** + * test_multiple_tags: + * + * Since: 2.0: one of these "Since:" + * tags is wrong... + */</output> +</test> + +</tests> diff --git a/tests/scanner/annotationparser/gi/tag_stability.xml b/tests/scanner/annotationparser/gi/tag_stability.xml new file mode 100644 index 00000000..25c907ff --- /dev/null +++ b/tests/scanner/annotationparser/gi/tag_stability.xml @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<tests xmlns="http://schemas.gnome.org/gobject-introspection/2013/test"> + +<test> + <input>/** + * annotation_versioned: + * + * Stability: Stable + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>stability</name> + <value>Stable</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Stability: Stable + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Stability: Unstable + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>stability</name> + <value>Unstable</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Stability: Unstable + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Stability: Private + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>stability</name> + <value>Private</value> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Stability: Private + */</output> +</test> + +<test> + <input>/** + * annotation_versioned: + * + * Stability: behavior tends to vary depending on the phase of the moon. + **/</input> + <parser> + <docblock> + <identifier> + <name>annotation_versioned</name> + </identifier> + <tags> + <tag> + <name>stability</name> + <description>behavior tends to vary depending on the phase of the moon.</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * annotation_versioned: + * + * Stability: behavior tends to vary depending on the phase of the moon. + */</output> +</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> + <value>Private</value> + </tag> + </tags> + </docblock> + <messages> + <message>6: Error: Test: annotations not supported for tag "Stability:".</message> + </messages> + </parser> + <output>/** + * test_tag_not_annotatable: + * + * Tags (except Returns:) don't have annotations + * + * Stability: Private + */</output> +</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> + <value>Private</value> + </tag> + </tags> + </docblock> + <messages> + <message>5: Error: Test: multiple "Stability:" tags for identifier "test_multiple_tags": + * Stability: Private + ^</message> + </messages> + </parser> + <output>/** + * test_multiple_tags: + * + * Stability: Private + */</output> +</test> + +<test> + <!-- + "Stability:" description + --> + <input>/** + * test_stability_description: + * + * Stability: Unstable: maybe one day this will work + * correctly... + **/</input> + <parser> + <docblock> + <identifier> + <name>test_stability_description</name> + </identifier> + <tags> + <tag> + <name>stability</name> + <value>Unstable</value> + <description>maybe one day this will work + correctly...</description> + </tag> + </tags> + </docblock> + </parser> + <output>/** + * test_stability_description: + * + * Stability: Unstable: maybe one day this will work + * correctly... + */</output> +</test> + +</tests> |