summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2022-02-28 12:12:56 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2022-02-28 12:12:56 +0100
commit2d4acc80e838f0ebd3520875bbbf2ba61bd2f234 (patch)
treef5d87b68771154911d1ddcab9cdc720075809225 /tests
parent03e74e5ecf286a43e5b6fa4ea986ae2031331245 (diff)
downloadvala-2d4acc80e838f0ebd3520875bbbf2ba61bd2f234.tar.gz
girparser: Handle duplicated and unnamed symbols
Issue warnings and skip such symbols to avoid errors on vala's side.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/gir/symbol-redefined.test27
-rw-r--r--tests/gir/symbol-without-name.test19
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index be5b9f4e7..91ab42c02 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -847,7 +847,9 @@ TESTS = \
gir/parameter-nullable-out-simple-type.test \
gir/property-non-readable.test \
gir/signal-virtual.test \
+ gir/symbol-redefined.test \
gir/symbol-type-csuffix.test \
+ gir/symbol-without-name.test \
gir/union.test \
gir/union-transparent.test \
girwriter/class-final.test \
diff --git a/tests/gir/symbol-redefined.test b/tests/gir/symbol-redefined.test
new file mode 100644
index 000000000..1ae3b3b5a
--- /dev/null
+++ b/tests/gir/symbol-redefined.test
@@ -0,0 +1,27 @@
+GIR
+
+Input:
+
+<enumeration name="Test"
+ c:type="Test">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_BAR">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_FOO">
+ </member>
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_BAR">
+ </member>
+</enumeration>
+
+Output:
+
+[CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)]
+public enum Test {
+ BAR,
+ FOO
+}
diff --git a/tests/gir/symbol-without-name.test b/tests/gir/symbol-without-name.test
new file mode 100644
index 000000000..4b56f6bdf
--- /dev/null
+++ b/tests/gir/symbol-without-name.test
@@ -0,0 +1,19 @@
+GIR
+
+Input:
+
+<function name="" c:identifier="test_foo">
+ <return-value transfer-ownership="none">
+ <type name="void"/>
+ </return-value>
+</function>
+<function name="bar" c:identifier="test_bar">
+ <return-value transfer-ownership="none">
+ <type name="void"/>
+ </return-value>
+</function>
+
+Output:
+
+[CCode (cheader_filename = "test.h")]
+public static void bar ();