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



commit 4028958be5aeb0de8b15bac7da1bd50d6772e3c8
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 acf0feac3..7783de89e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -641,6 +641,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 \
@@ -653,6 +654,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]