summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-08-21 12:16:30 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-10-08 20:55:56 +0200
commit35278b955304eb62565b5578b6848494721847bd (patch)
tree101e6c9846232daaa36cc394c6f538912473e697 /tests
parent4ff3c660de64ba423659bd796fbd944b7af1913d (diff)
downloadgobject-introspection-35278b955304eb62565b5578b6848494721847bd.tar.gz
giscanner: refactor annotation validation
- annotations on the identifier (formerly g-i specific tags) have never been validated before, so fix this - removes duplicate validation code from GtkDocTag and GtkDocParameter - remove repeated validation code doing the same thing as annotationparser from maintransformer...
Diffstat (limited to 'tests')
-rw-r--r--tests/scanner/annotationparser/gi/tag_returns.xml32
-rw-r--r--tests/warn/callback-invalid-scope.h7
-rw-r--r--tests/warn/invalid-array.h12
-rw-r--r--tests/warn/invalid-closure.h2
-rw-r--r--tests/warn/invalid-element-type.h47
-rw-r--r--tests/warn/invalid-out.h2
-rw-r--r--tests/warn/invalid-transfer.h6
7 files changed, 68 insertions, 40 deletions
diff --git a/tests/scanner/annotationparser/gi/tag_returns.xml b/tests/scanner/annotationparser/gi/tag_returns.xml
index b5643b37..96ee8049 100644
--- a/tests/scanner/annotationparser/gi/tag_returns.xml
+++ b/tests/scanner/annotationparser/gi/tag_returns.xml
@@ -333,4 +333,36 @@ parameter is encountered.</description>
</parser>
</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>
+</test>
+
</tests>
diff --git a/tests/warn/callback-invalid-scope.h b/tests/warn/callback-invalid-scope.h
index 583dc0ca..d07f172e 100644
--- a/tests/warn/callback-invalid-scope.h
+++ b/tests/warn/callback-invalid-scope.h
@@ -7,7 +7,7 @@
*/
void test_callback_invalid(GCallback *callback, gpointer user_data);
-// EXPECT:5: Warning: Test: invalid scope annotation value: 'invalid'
+// EXPECT:5: Warning: Test: invalid "scope" annotation option: "invalid"
/**
* test_callback_invalid2:
@@ -16,7 +16,7 @@ void test_callback_invalid(GCallback *callback, gpointer user_data);
*/
void test_callback_invalid2(GCallback *callback, gpointer user_data);
-// EXPECT:14: Warning: Test: scope annotation needs a value
+// EXPECT:14: Warning: Test: "scope" annotation needs one option, none given
/**
* test_callback_invalid3:
@@ -25,7 +25,8 @@ void test_callback_invalid2(GCallback *callback, gpointer user_data);
*/
void test_callback_invalid3(GCallback *callback, gpointer user_data);
-// EXPECT:23: Warning: Test: scope annotation needs one value, not 2
+// EXPECT:23: Warning: Test: "scope" annotation needs one option, 2 given
+// EXPECT:23: Warning: Test: invalid "scope" annotation option: "invalid"
// EXPECT:13: Warning: Test: test_callback_invalid2: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
// EXPECT:22: Warning: Test: test_callback_invalid3: argument callback: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
diff --git a/tests/warn/invalid-array.h b/tests/warn/invalid-array.h
index a4a4e47e..b9b828cf 100644
--- a/tests/warn/invalid-array.h
+++ b/tests/warn/invalid-array.h
@@ -7,7 +7,7 @@
void
test_invalid_array (char ***out1);
-// EXPECT:5: Warning: Test: invalid array annotation value: 'foobar'
+// EXPECT:5: Warning: Test: invalid "array" annotation option: "foobar"
/**
* test_invalid_array_zero_terminated:
@@ -18,8 +18,8 @@ void
test_invalid_array_zero_terminated (char ***out1,
char ***out2);
-// EXPECT:14: Warning: Test: array option zero-terminated needs a value
-// EXPECT:15: Warning: Test: invalid array zero-terminated option value 'foobar', must be an integer
+// EXPECT:14: Warning: Test: "array" annotation option "zero-terminated" needs a value
+// EXPECT:15: Warning: Test: invalid "array" annotation option "zero-terminated" value "foobar", must be an integer
/**
* test_invalid_array_fixed_size:
@@ -30,8 +30,8 @@ void
test_invalid_array_fixed_size (char ***out1,
char ***out2);
-// EXPECT:26: Warning: Test: array option fixed-size needs a value
-// EXPECT:27: Warning: Test: invalid array fixed-size option value 'foobar', must be an integer
+// EXPECT:26: Warning: Test: "array" annotation option "fixed-size" needs a value
+// EXPECT:27: Warning: Test: invalid "array" annotation option "fixed-size" value "foobar", must be an integer
/**
* test_invalid_array_length:
@@ -41,4 +41,4 @@ void
test_invalid_array_length (char ***out1,
char ***out2);
-// EXPECT:38: Warning: Test: array option length needs a value
+// EXPECT:38: Warning: Test: "array" annotation option "length" needs a value
diff --git a/tests/warn/invalid-closure.h b/tests/warn/invalid-closure.h
index 50ba0864..9769804b 100644
--- a/tests/warn/invalid-closure.h
+++ b/tests/warn/invalid-closure.h
@@ -5,4 +5,4 @@
*/
void test_invalid_closure(int param);
-// EXPECT:4: Warning: Test: closure takes at most 1 value, 2 given
+// EXPECT:4: Warning: Test: "closure" annotation takes at most one option, 2 given
diff --git a/tests/warn/invalid-element-type.h b/tests/warn/invalid-element-type.h
index 97b8281d..8028fb71 100644
--- a/tests/warn/invalid-element-type.h
+++ b/tests/warn/invalid-element-type.h
@@ -8,8 +8,11 @@
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
+// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
+// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
+// EXPECT:6: Warning: Test: "element-type" annotation for a list must have exactly one option, not 2 options
+// EXPECT:5: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:5: Warning: Test: "element-type" annotation for a list must have exactly one option, not 0 options
/**
* test_invalid_array_element_type:
@@ -19,8 +22,7 @@ void test_invalid_list_element_type(GList *l1, GList *l2);
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
+// EXPECT:19: Warning: Test: "element-type" annotation takes at least one option, none given
/**
* test_invalid_hash_element_type:
@@ -31,9 +33,9 @@ void test_invalid_array_element_type(const char *a1, const char *a2);
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 most 2 values, 3 given
+// EXPECT:29: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:29: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 0 option(s)
+// EXPECT:31: Warning: Test: "element-type" annotation takes at most 2 options, 3 given
/**
* test_invalid_bytearray_element_type:
@@ -43,8 +45,8 @@ void test_invalid_hash_element_type(GHashTable *h1, GHashTable *h2, GHashTable *
void test_invalid_bytearray_element_type(GByteArray *b1, GByteArray *b2);
-// EXPECT:40: Warning: Test: element-type annotation needs a value
-// EXPECT:40: Warning: Test: element-type takes at least one value, none given
+// EXPECT:42: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:42: Warning: Test: "element-type" annotation for an array must have exactly one option, not 0 options
/**
* test_invalid_ptrarray_element_type:
@@ -54,8 +56,8 @@ void test_invalid_bytearray_element_type(GByteArray *b1, GByteArray *b2);
void test_invalid_ptrarray_element_type(GPtrArray *p1, GPtrArray *p2);
-// EXPECT:51: Warning: Test: element-type annotation needs a value
-// EXPECT:51: Warning: Test: element-type takes at least one value, none given
+// EXPECT:53: Warning: Test: "element-type" annotation takes at least one option, none given
+// EXPECT:53: Warning: Test: "element-type" annotation for an array must have exactly one option, not 0 options
/**
* test_unresolved_element_type:
@@ -74,19 +76,12 @@ GList* test_unresolved_element_type(void);
GPtrArray* test_unresolved_value_element_type(void);
-// EXPECT:5: Warning: Test: element-type annotation for a list must have exactly one option, not 0 options
-// EXPECT:6: Warning: Test: element-type annotation for a list must have exactly one option, not 2 options
-// EXPECT:20: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation
+// EXPECT:19: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation
// EXPECT:20: Warning: Test: Unknown container Type(target_fundamental=utf8, ctype=char*) for element-type annotation
-// EXPECT:27: Warning: Test: element-type annotation for a hash table must have exactly two options, not 0 option(s)
-// 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:40: Warning: Test: element-type annotation for an array must have exactly one option, not 0 options
-// EXPECT:41: Warning: Test: invalid (element-type) for a GByteArray, must be one of guint8, gint8 or gchar
-// EXPECT:51: Warning: Test: element-type annotation for an array must have exactly one option, not 0 options
-// EXPECT:52: Warning: Test: invalid (element-type) for a GPtrArray, must be a pointer
-// EXPECT:63: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
-// EXPECT:71: Warning: Test: test_unresolved_value_element_type: Unknown type: 'GLib.Value'
-// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l1: Missing (element-type) annotation
-// EXPECT:4: Warning: Test: test_invalid_list_element_type: argument l2: Missing (element-type) annotation
-// EXPECT:50: Warning: Test: test_invalid_ptrarray_element_type: argument p1: Missing (element-type) annotation
+// EXPECT:30: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 1 option(s)
+// EXPECT:31: Warning: Test: "element-type" annotation for a hash table must have exactly two options, not 3 option(s)
+// EXPECT:43: Warning: Test: invalid (element-type) for a GByteArray, must be one of guint8, gint8 or gchar
+// EXPECT:52: Warning: Test: test_invalid_ptrarray_element_type: argument p1: Missing (element-type) annotation
+// EXPECT:54: Warning: Test: invalid (element-type) for a GPtrArray, must be a pointer
+// EXPECT:65: Warning: Test: test_unresolved_element_type: Unknown type: 'Unresolved'
+// EXPECT:73: Warning: Test: test_unresolved_value_element_type: Unknown type: 'GLib.Value'
diff --git a/tests/warn/invalid-out.h b/tests/warn/invalid-out.h
index fcb4f70f..7e6ec34f 100644
--- a/tests/warn/invalid-out.h
+++ b/tests/warn/invalid-out.h
@@ -5,4 +5,4 @@
void test_invalid_out(int *out);
-// EXPECT:3: Warning: Test: out annotation value is invalid: 'invalid'
+// EXPECT:3: Warning: Test: invalid "out" annotation option: "invalid"
diff --git a/tests/warn/invalid-transfer.h b/tests/warn/invalid-transfer.h
index 3579ad15..ec43f2ac 100644
--- a/tests/warn/invalid-transfer.h
+++ b/tests/warn/invalid-transfer.h
@@ -7,6 +7,6 @@
*/
void test_transfer_invalid(int param, int param2, int param3);
-// EXPECT:4: Warning: Test: transfer annotation needs a value
-// EXPECT:5: Warning: Test: invalid transfer annotation value: 'invalid'
-// EXPECT:6: Warning: Test: transfer annotation needs one value, not 2
+// EXPECT:4: Warning: Test: "transfer" annotation needs one option, none given
+// EXPECT:5: Warning: Test: invalid "transfer" annotation option: "invalid"
+// EXPECT:6: Warning: Test: "transfer" annotation needs one option, 2 given