[vala/staging] tests: Add "constant and union" gir test to increase coverage



commit eff666b4d337e7d91b31462c48d438db2c7170ce
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Aug 10 11:56:47 2020 +0200

    tests: Add "constant and union" gir test to increase coverage

 tests/Makefile.am       |  2 ++
 tests/gir/constant.test | 22 ++++++++++++++++++++++
 tests/gir/union.test    | 20 ++++++++++++++++++++
 3 files changed, 44 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e1bfc0625..c2505dcba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -647,6 +647,7 @@ TESTS = \
        gir/async-result-pos.test \
        gir/async-sync-out.test \
        gir/class.test \
+       gir/constant.test \
        gir/delegate-alias-without-target.test \
        gir/delegate-array-length-type.test \
        gir/delegate-closure-destroy-index-conflict.test \
@@ -659,6 +660,7 @@ TESTS = \
        gir/parameter-nullable-out-simple-type.test \
        gir/property-non-readable.test \
        gir/symbol-type-csuffix.test \
+       gir/union.test \
        annotations/deprecated.vala \
        annotations/description.vala \
        annotations/noaccessormethod.test \
diff --git a/tests/gir/constant.test b/tests/gir/constant.test
new file mode 100644
index 000000000..196ae7577
--- /dev/null
+++ b/tests/gir/constant.test
@@ -0,0 +1,22 @@
+GIR
+
+Input:
+
+<constant name="FOO_CONSTANT"
+          value="foo-constant-string-value"
+          c:type="TEST_FOO_CONSTANT">
+  <type name="utf8" c:type="gchar*"/>
+</constant>
+<constant name="FOO_CONSTANT_ARRAY"
+          c:type="TEST_FOO_CONSTANT_ARRAY">
+  <array c:type="const gchar**">
+    <type name="utf8" c:type="const gchar*"/>
+  </array>
+</constant>
+
+Output:
+
+[CCode (cheader_filename = "test.h", cname = "TEST_FOO_CONSTANT")]
+public const string FOO_CONSTANT;
+[CCode (array_length = false, array_null_terminated = true, cheader_filename = "test.h", cname = 
"TEST_FOO_CONSTANT_ARRAY")]
+public const string[] FOO_CONSTANT_ARRAY;
diff --git a/tests/gir/union.test b/tests/gir/union.test
new file mode 100644
index 000000000..51f118aa5
--- /dev/null
+++ b/tests/gir/union.test
@@ -0,0 +1,20 @@
+GIR
+
+Input:
+
+<union name="Foo" c:type="TestFoo">
+  <field name="bar" writable="1">
+    <type name="guint" c:type="guint"/>
+  </field>
+  <field name="manam" writable="1">
+    <type name="gint" c:type="gint"/>
+  </field>
+</union>
+
+Output:
+
+[CCode (cheader_filename = "test.h")]
+public struct Foo {
+       public uint bar;
+       public int manam;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]