From af2e146f5f24b93322ad0112d37a8e41222c3085 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 4 Jul 2012 11:58:13 +0200 Subject: giscanner: add AnnotationParser tests The tests in giscanner/annotationpatters.py only test the regular expression programs used when parsing GTK-Doc comment blocks but do not test the structure of the resulting "parse tree". This patch adds 193 GTK-Doc comment blocks and the expected results AnnotationParser should return (with it's current level of understanding of GTK-Doc comment block syntax). These are compared by tests/scanner/annotationparser/test_parser.py which complains with a diff on failure. https://bugzilla.gnome.org/show_bug.cgi?id=688897 --- .../annotationparser/gi/annotation_array.xml | 277 +++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 tests/scanner/annotationparser/gi/annotation_array.xml (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml new file mode 100644 index 00000000..26bb1104 --- /dev/null +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -0,0 +1,277 @@ + + + + + + /** + * annotation_object_compute_sum: + * @nums: (array): Sequence of numbers + * + * Test taking a zero-terminated array + **/ + + + annotation_object_compute_sum + + + + nums + + + array + + + Sequence of numbers + + + Test taking a zero-terminated array + + + + + /** + * 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 + **/ + + + annotation_object_compute_sum_n + + + + object + a #AnnotationObject + + + nums + + + array + + + + + + + Sequence of numbers that are zero-terminated + + + n_nums + Length of number array + + + Test taking an array with length parameter + + + + + /** + * 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 + **/ + + + annotation_object_compute_sum_nz + + + + object + a #AnnotationObject + + + nums + + + array + + + + + + + Sequence of numbers that are zero-terminated + + + n_nums + Length of number array + + + Test taking a zero-terminated array with length parameter + + + + + /** + * 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 + **/ + + + annotation_object_parse_args + + + + object + a #AnnotationObject + + + argc + + + inout + + + Length of the argument vector + + + argv + + + inout + + + array + + + + + + + Argument vector + + + Test taking a zero-terminated array with length parameter + + + + + /** + * 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. + **/ + + + annotation_object_set_data + + + + object + a #AnnotationObject + + + data + + + array + + + + + + The data + + + length + Length of the data + + + Test taking a guchar * with a length. + + + + + /** + * annotation_string_zero_terminated: + * @data: (array fixed-size=2): a third value + * + * Return value: (transfer full) (array zero-terminated=1): The return value + */ + + + annotation_string_zero_terminated + + + + data + + + array + + + + + + a third value + + + + + returns + + + transfer + + + + + + array + + + + + + The return value + + + + + + -- cgit v1.2.1 From 146a56f7f358dc14989e198fee4c2dd01b55be07 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 15 May 2013 14:42:09 +0200 Subject: tests: rename element to We'll start testing parser warning/error messages and serialized output later on so this will make it easier to see what's parser input and output... --- .../annotationparser/gi/annotation_array.xml | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index 26bb1104..2957900c 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -3,12 +3,12 @@ - /** + /** * annotation_object_compute_sum: * @nums: (array): Sequence of numbers * * Test taking a zero-terminated array - **/ + **/ annotation_object_compute_sum @@ -29,7 +29,7 @@ - /** + /** * annotation_object_compute_sum_n: * @object: a #AnnotationObject * @nums: (array length=n_nums zero-terminated=0): Sequence of @@ -37,7 +37,7 @@ * @n_nums: Length of number array * * Test taking an array with length parameter - **/ + **/ annotation_object_compute_sum_n @@ -76,7 +76,7 @@ - /** + /** * annotation_object_compute_sum_nz: * @object: a #AnnotationObject * @nums: (array length=n_nums zero-terminated=1): Sequence of numbers that @@ -84,7 +84,7 @@ * @n_nums: Length of number array * * Test taking a zero-terminated array with length parameter - **/ + **/ annotation_object_compute_sum_nz @@ -123,14 +123,14 @@ - /** + /** * 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 - **/ + **/ annotation_object_parse_args @@ -177,14 +177,14 @@ - /** + /** * 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. - **/ + **/ annotation_object_set_data @@ -219,12 +219,12 @@ - /** + /** * annotation_string_zero_terminated: * @data: (array fixed-size=2): a third value * * Return value: (transfer full) (array zero-terminated=1): The return value - */ + */ annotation_string_zero_terminated -- cgit v1.2.1 From 1359fb6d7a76609ec07e22af9cd79ae604d23d20 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 15 May 2013 17:31:14 +0200 Subject: tests: put element inside a element The element can then hold both the expected parse tree and the warning/error messages emitted by the parser in a future child element. --- .../annotationparser/gi/annotation_array.xml | 428 +++++++++++---------- 1 file changed, 220 insertions(+), 208 deletions(-) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index 2957900c..062c7724 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -9,23 +9,25 @@ * * Test taking a zero-terminated array **/ - - - annotation_object_compute_sum - - - - nums - - - array - - - Sequence of numbers - - - Test taking a zero-terminated array - + + + + annotation_object_compute_sum + + + + nums + + + array + + + Sequence of numbers + + + Test taking a zero-terminated array + + @@ -38,41 +40,43 @@ * * Test taking an array with length parameter **/ - - - annotation_object_compute_sum_n - - - - object - a #AnnotationObject - - - nums - - - array - - - - - - - Sequence of numbers that are zero-terminated - - - n_nums - Length of number array - - - Test taking an array with length parameter - + + + + annotation_object_compute_sum_n + + + + object + a #AnnotationObject + + + nums + + + array + + + + + + + Sequence of numbers that are zero-terminated + + + n_nums + Length of number array + + + Test taking an array with length parameter + + @@ -85,41 +89,43 @@ * * Test taking a zero-terminated array with length parameter **/ - - - annotation_object_compute_sum_nz - - - - object - a #AnnotationObject - - - nums - - - array - - - - - - - Sequence of numbers that are zero-terminated - - - n_nums - Length of number array - - - Test taking a zero-terminated array with length parameter - + + + + annotation_object_compute_sum_nz + + + + object + a #AnnotationObject + + + nums + + + array + + + + + + + Sequence of numbers that are zero-terminated + + + n_nums + Length of number array + + + Test taking a zero-terminated array with length parameter + + @@ -131,49 +137,51 @@ * * Test taking a zero-terminated array with length parameter **/ - - - annotation_object_parse_args - - - - object - a #AnnotationObject - - - argc - - - inout - - - Length of the argument vector - - - argv - - - inout - - - array - - - - - - - Argument vector - - - Test taking a zero-terminated array with length parameter - + + + + annotation_object_parse_args + + + + object + a #AnnotationObject + + + argc + + + inout + + + Length of the argument vector + + + argv + + + inout + + + array + + + + + + + Argument vector + + + Test taking a zero-terminated array with length parameter + + @@ -185,37 +193,39 @@ * * Test taking a guchar * with a length. **/ - - - annotation_object_set_data - - - - object - a #AnnotationObject - - - data - - - array - - - - - - The data - - - length - Length of the data - - - Test taking a guchar * with a length. - + + + + annotation_object_set_data + + + + object + a #AnnotationObject + + + data + + + array + + + + + + The data + + + length + Length of the data + + + Test taking a guchar * with a length. + + @@ -225,53 +235,55 @@ * * Return value: (transfer full) (array zero-terminated=1): The return value */ - - - annotation_string_zero_terminated - - - - data - - - array - - - - - - a third value - - - - - returns - - - transfer - - - - - - array - - - - - - The return value - - - + + + + annotation_string_zero_terminated + + + + data + + + array + + + + + + a third value + + + + + returns + + + transfer + + + + + + array + + + + + + The return value + + + + -- cgit v1.2.1 From d464fb1f18173fea1aa3028cf44002944419b6ee Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 22 May 2013 07:39:32 +0200 Subject: tests: validate GTK-Doc test files This is more of a handy developer tool than something that is always expected to be executed as part of the test suite, so we don't add a hard dependency on xmllint. https://bugzilla.gnome.org/show_bug.cgi?id=688897 --- tests/scanner/annotationparser/gi/annotation_array.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index 062c7724..a59c267a 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -1,6 +1,6 @@ - + /** -- cgit v1.2.1 From ba425f1fd48df193fe7a8c6cc559f0b408160604 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Wed, 14 Aug 2013 17:00:39 +0200 Subject: giscanner: honor line and paragraph breaks in description fields GTK-Doc parameter description fields are allowed to span multiple lines, tag description fields are allowed to span multiple lines and paragraphs. A tool fixing/rewriting GTK-Doc comment blocks in source files would need to have description fields parsed and stored (almost) exactly as they appear in the source file. --- tests/scanner/annotationparser/gi/annotation_array.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index a59c267a..b821dcfc 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -67,7 +67,8 @@ - Sequence of numbers that are zero-terminated + Sequence of + numbers that are zero-terminated n_nums @@ -116,7 +117,8 @@ - Sequence of numbers that are zero-terminated + Sequence of numbers that +are zero-terminated n_nums -- cgit v1.2.1 From 4b690b187bf8d0b7b571faaa050986b796e797a4 Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Tue, 13 Aug 2013 15:01:00 +0200 Subject: giscanner: add missing tests --- .../annotationparser/gi/annotation_array.xml | 133 +++++++++++++++++++++ 1 file changed, 133 insertions(+) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index b821dcfc..bf00191c 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -288,4 +288,137 @@ are zero-terminated + + /** + * annotation_string_zero_terminated: + * @data: (array invalid fixed-size=2): a third value + * + * Return value: (transfer full) (array zero-terminated=1): The return value + */ + + + + annotation_string_zero_terminated + + + + data + + + array + + + + + + + a third value + + + + + returns + + + transfer + + + + + + array + + + + + + The return value + + + + + 3: Warning: Test: invalid "array" annotation option: "invalid" + + + + + + /** + * g_app_launch_context_get_environment: + * @arg1: (array zero-terminated): ... + * @arg2: (array length): ... + * + * Returns: (array zero-terminated=yes): the child's environment + */ + + + + g_app_launch_context_get_environment + + + + arg1 + + + array + + + + + + ... + + + arg2 + + + array + + + + + + ... + + + + + returns + + + array + + + + + + the child's environment + + + + + 3: Warning: Test: "array" annotation option "zero-terminated" needs a value + 4: Warning: Test: "array" annotation option "length" needs a value + 6: Warning: Test: invalid "array" annotation option "zero-terminated" value "yes", must be an integer + + + + -- cgit v1.2.1 From 6a874b86a1b9aae0c50a30b8cd3033870797eb1c Mon Sep 17 00:00:00 2001 From: Dieter Verfaillie Date: Tue, 23 Jul 2013 17:34:07 +0200 Subject: giscanner: refactor GTK-Doc comment block serialization --- .../annotationparser/gi/annotation_array.xml | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'tests/scanner/annotationparser/gi/annotation_array.xml') diff --git a/tests/scanner/annotationparser/gi/annotation_array.xml b/tests/scanner/annotationparser/gi/annotation_array.xml index bf00191c..3a7cbc0b 100644 --- a/tests/scanner/annotationparser/gi/annotation_array.xml +++ b/tests/scanner/annotationparser/gi/annotation_array.xml @@ -28,6 +28,12 @@ Test taking a zero-terminated array + /** + * annotation_object_compute_sum: + * @nums: (array): Sequence of numbers + * + * Test taking a zero-terminated array + */ @@ -78,6 +84,15 @@ Test taking an array with length parameter + /** + * 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 + */ @@ -128,6 +143,15 @@ are zero-terminated Test taking a zero-terminated array with length parameter + /** + * 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 + */ @@ -184,6 +208,14 @@ are zero-terminated Test taking a zero-terminated array with length parameter + /** + * 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 + */ @@ -228,6 +260,14 @@ are zero-terminated Test taking a guchar * with a length. + /** + * 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. + */ @@ -286,6 +326,12 @@ are zero-terminated + /** + * annotation_string_zero_terminated: + * @data: (array fixed-size=2): a third value + * + * Returns: (transfer full) (array zero-terminated=1): The return value + */ @@ -350,6 +396,12 @@ are zero-terminated 3: Warning: Test: invalid "array" annotation option: "invalid" + /** + * annotation_string_zero_terminated: + * @data: (array invalid fixed-size=2): a third value + * + * Returns: (transfer full) (array zero-terminated=1): The return value + */ @@ -419,6 +471,13 @@ are zero-terminated 6: Warning: Test: invalid "array" annotation option "zero-terminated" value "yes", must be an integer + /** + * g_app_launch_context_get_environment: + * @arg1: (array zero-terminated): ... + * @arg2: (array length): ... + * + * Returns: (array zero-terminated=yes): the child's environment + */ -- cgit v1.2.1