summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2010-09-23 17:13:29 -0300
committerJohan Dahlin <johan@gnome.org>2010-09-23 17:25:47 -0300
commite2b95cdb39d6e5f287e23dbf30a04031b49a230f (patch)
treeb3d36b0a28cf358dc1ce40459d57e4638eb965b1 /tests
parent2525786185e0f9025f88c00769d948d2b83d646d (diff)
downloadgobject-introspection-e2b95cdb39d6e5f287e23dbf30a04031b49a230f.tar.gz
[scanner] Warn for invalid scanner annotations
Warn for invalid annotations. Change so that custom attributes have to use the annotation keyword.
Diffstat (limited to 'tests')
-rw-r--r--tests/scanner/Annotation-1.0-expected.gir4
-rw-r--r--tests/scanner/annotation.c10
-rw-r--r--tests/warn/Makefile.am1
-rw-r--r--tests/warn/invalid-option.h8
4 files changed, 16 insertions, 7 deletions
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir
index 6d72dd4f..f922d582 100644
--- a/tests/scanner/Annotation-1.0-expected.gir
+++ b/tests/scanner/Annotation-1.0-expected.gir
@@ -609,8 +609,8 @@ it says it's pointer but it's actually a string.</doc>
</record>
<function name="attribute_func" c:identifier="annotation_attribute_func">
<return-value transfer-ownership="none">
- <attribute name="yet.another.annotation" value="another_value"/>
<attribute name="some.other.annotation" value="value2"/>
+ <attribute name="yet.another.annotation" value="another_value"/>
<doc xml:whitespace="preserve">The return value.</doc>
<type name="gint" c:type="gint"/>
</return-value>
@@ -620,8 +620,8 @@ it says it's pointer but it's actually a string.</doc>
<type name="Object" c:type="AnnotationObject*"/>
</parameter>
<parameter name="data" transfer-ownership="none">
- <attribute name="another.annotation" value="blahvalue"/>
<attribute name="some.annotation" value="value"/>
+ <attribute name="another.annotation" value="blahvalue"/>
<doc xml:whitespace="preserve">Some data.</doc>
<type name="utf8" c:type="gchar*"/>
</parameter>
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 40df0860..e2e0991f 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -122,12 +122,12 @@ annotation_object_class_init (AnnotationObjectClass *klass)
/**
* AnnotationObject::attribute-signal:
* @annotation: the annotation object
- * @arg1: (some.annotation.foo1 val1): a value
- * @arg2: (some.annotation.foo2 val2): another value
+ * @arg1: (attribute some.annotation.foo1 val1): a value
+ * @arg2: (attribute some.annotation.foo2 val2): another value
*
* This signal tests a signal with attributes.
*
- * Returns: (some.annotation.foo3 val3): the return value
+ * Returns: (attribute some.annotation.foo3 val3): the return value
*/
annotation_object_signals[ATTRIBUTE_SIGNAL] =
g_signal_new ("attribute-signal",
@@ -734,9 +734,9 @@ annotation_ptr_array (GPtrArray *array)
/**
* annotation_attribute_func:
* @object: A #AnnotationObject.
- * @data: (some.annotation value) (another.annotation blahvalue): Some data.
+ * @data: (attribute some.annotation value) (attribute another.annotation blahvalue): Some data.
*
- * Returns: (some.other.annotation value2) (yet.another.annotation another_value): The return value.
+ * Returns: (attribute some.other.annotation value2) (attribute yet.another.annotation another_value): The return value.
*/
gint
annotation_attribute_func (AnnotationObject *object,
diff --git a/tests/warn/Makefile.am b/tests/warn/Makefile.am
index 81c7442b..44515d7e 100644
--- a/tests/warn/Makefile.am
+++ b/tests/warn/Makefile.am
@@ -4,6 +4,7 @@ TESTS = \
callback-invalid-scope.h \
callback-missing-scope.h \
return-gobject.h \
+ invalid-option.h \
unknown-parameter.h \
unresolved-element-type.h \
unresolved-type.h
diff --git a/tests/warn/invalid-option.h b/tests/warn/invalid-option.h
new file mode 100644
index 00000000..22483bb9
--- /dev/null
+++ b/tests/warn/invalid-option.h
@@ -0,0 +1,8 @@
+
+/**
+ * func:
+ * @param: (invalid-annotation-option):
+ */
+void test_func(int param);
+
+// EXPECT:4: Warning: Test: invalid option: invalid-annotation-option