diff options
author | Johan Dahlin <johan@gnome.org> | 2010-09-24 09:59:43 -0300 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2010-09-24 11:03:52 -0300 |
commit | 7c3d1e7c5d6d209c262789b22ea6a99b0636771d (patch) | |
tree | b2caa2aa878d46e0b9456bf3d4836d693fb3e6c5 /tests | |
parent | 013937b79ce3467068352e6dd0179efaf2563ac7 (diff) | |
download | gobject-introspection-7c3d1e7c5d6d209c262789b22ea6a99b0636771d.tar.gz |
[annotationparser] Validate the rest of the annotations
All option annotations, which uses parenthesis are now
properly validated for number of values they expect
Diffstat (limited to 'tests')
-rw-r--r-- | tests/warn/Makefile.am | 3 | ||||
-rw-r--r-- | tests/warn/invalid-element-type.h | 54 | ||||
-rw-r--r-- | tests/warn/invalid-out.h | 8 | ||||
-rw-r--r-- | tests/warn/unresolved-element-type.h | 11 |
4 files changed, 64 insertions, 12 deletions
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am index bdcc9707..26c2dcbb 100644 --- a/tests/warn/Makefile.am +++ b/tests/warn/Makefile.am @@ -4,10 +4,11 @@ TESTS = \ callback-invalid-scope.h \ callback-missing-scope.h \ return-gobject.h \ + invalid-element-type.h \ invalid-option.h \ + invalid-out.h \ invalid-transfer.h \ unknown-parameter.h \ - unresolved-element-type.h \ unresolved-type.h EXTRA_DIST = warningtester.py common.h $(TESTS) diff --git a/tests/warn/invalid-element-type.h b/tests/warn/invalid-element-type.h new file mode 100644 index 00000000..f2cf2b93 --- /dev/null +++ b/tests/warn/invalid-element-type.h @@ -0,0 +1,54 @@ +#include "common.h" + +/** + * test_invalid_list_element_type: + * @l1: (element-type): + * @l2: (element-type int int): + */ + +void test_invalid_list_element_type(GList *l1, GList *l2); + +// EXPECT:5: Warning: Test: element-type annotation needs a value +// EXPECT:5: Warning: Test: element-type takes at least one value, none given + +/** + * test_invalid_array_element_type: + * @a1: (element-type): + * @a2: (element-type int int): + */ + +void test_invalid_array_element_type(const char *a1, const char *a2); + +// EXPECT:16: Warning: Test: element-type annotation needs a value +// EXPECT:16: Warning: Test: element-type takes at least one value, none given + +/** + * test_invalid_hash_element_type: + * @h1: (element-type): + * @h2: (element-type int): + * @h3: (element-type int int int): + */ + +void test_invalid_hash_element_type(GHashTable *h1, GHashTable *h2, GHashTable *h3); + +// EXPECT:27: Warning: Test: element-type annotation needs a value +// EXPECT:27: Warning: Test: element-type takes at least one value, none given +// EXPECT:29: Warning: Test: element-type takes at maximium 2 values, 3 given + +/** + * test_unresolved_element_type: + * + * Returns: (element-type Unresolved) (transfer full): + */ + +GList* test_unresolved_element_type(void); + + +// EXPECT:5: Warning: Test: element-type annotation takes at least one option, none given +// EXPECT:6: Warning: Test: element-type annotation for a list must have exactly one option, not 2 options +// EXPECT:16: Warning: Test: element-type annotation takes at least one option, none given +// EXPECT:20: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation +// EXPECT:27: Warning: Test: element-type annotation takes at least one option, none given +// EXPECT:28: Warning: Test: element-type annotation for a hash table must have exactly two options, not 1 option(s) +// EXPECT:29: Warning: Test: element-type annotation for a hash table must have exactly two options, not 3 option(s) +// EXPECT:41: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved' diff --git a/tests/warn/invalid-out.h b/tests/warn/invalid-out.h new file mode 100644 index 00000000..fcb4f70f --- /dev/null +++ b/tests/warn/invalid-out.h @@ -0,0 +1,8 @@ +/** + * test_invalid_out: + * @out: (out invalid): + */ + +void test_invalid_out(int *out); + +// EXPECT:3: Warning: Test: out annotation value is invalid: 'invalid' diff --git a/tests/warn/unresolved-element-type.h b/tests/warn/unresolved-element-type.h deleted file mode 100644 index 26e13da9..00000000 --- a/tests/warn/unresolved-element-type.h +++ /dev/null @@ -1,11 +0,0 @@ -#include "common.h" - -/** - * test_unresolved_element_type: - * - * Returns: (element-type Unresolved) (transfer full): - */ - -GList* test_unresolved_element_type(void); - -// EXPECT:6: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved' |