[vala/0.48] tests: Add more "girparser" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] tests: Add more "girparser" tests to increase coverage
- Date: Sun, 28 Feb 2021 17:26:27 +0000 (UTC)
commit a23c150d6931579efb0e4f86419cf0f440dd9828
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Feb 21 19:34:48 2021 +0100
tests: Add more "girparser" tests to increase coverage
tests/Makefile.am | 2 ++
tests/gir/alias.test | 14 ++++++++++++++
tests/gir/class.test | 14 ++++++++++++++
tests/gir/union-transparent.test | 30 ++++++++++++++++++++++++++++++
4 files changed, 60 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a39f19d9c..1bbf87fad 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -690,6 +690,7 @@ TESTS = \
gir/bug742012.test \
gir/bug788775.test \
gir/bug792998.test \
+ gir/alias.test \
gir/array-fixed-length.test \
gir/async-result-pos.test \
gir/async-sync-out.test \
@@ -709,6 +710,7 @@ TESTS = \
gir/property-non-readable.test \
gir/symbol-type-csuffix.test \
gir/union.test \
+ gir/union-transparent.test \
gtktemplate/gtkcallback-incompatible.test \
gtktemplate/gtkcallback-unknown.test \
gtktemplate/gtkchild-field-incompatible-type.test \
diff --git a/tests/gir/alias.test b/tests/gir/alias.test
new file mode 100644
index 000000000..132d32af2
--- /dev/null
+++ b/tests/gir/alias.test
@@ -0,0 +1,14 @@
+GIR
+
+Input:
+
+<alias name="Foo" c:type="TestFoo">
+ <type name="gint" c:type="int"/>
+</alias>
+
+Output:
+
+[CCode (cheader_filename = "test.h")]
+[SimpleType]
+public struct Foo : int {
+}
diff --git a/tests/gir/class.test b/tests/gir/class.test
index 578c0b82e..cf265569d 100644
--- a/tests/gir/class.test
+++ b/tests/gir/class.test
@@ -2,6 +2,12 @@ GIR
Input:
+<alias name="Bar" c:type="TestBar">
+ <type name="Foo" c:type="TestFoo"/>
+</alias>
+<alias name="IBar" c:type="TestIBar">
+ <type name="IFoo" c:type="TestIFoo"/>
+</alias>
<class name="Foo" c:type="TestFoo" glib:type-name="TestFoo" glib:get-type="test_foo_get_type"
glib:type-struct="FooClass" parent="GObject.Object">
<implements name="Test.IFoo"/>
<method name="method_virtual" c:identifier="test_foo_method_virtual" throws="1">
@@ -127,6 +133,11 @@ Input:
Output:
+[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
+public class Bar : Test.Foo {
+ [CCode (has_construct_function = false)]
+ protected Bar ();
+}
[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")]
public class Foo : GLib.Object, Test.IFoo {
[CCode (has_construct_function = false)]
@@ -140,6 +151,9 @@ public class Foo : GLib.Object, Test.IFoo {
public string prop { owned get; set construct; }
public signal void sig (string arg);
}
+[CCode (cheader_filename = "test.h")]
+public interface IBar : Test.IFoo, GLib.Object {
+}
[CCode (cheader_filename = "test.h", type_id = "test_ifoo_get_type ()")]
public interface IFoo : GLib.Object {
public abstract void method () throws GLib.Error;
diff --git a/tests/gir/union-transparent.test b/tests/gir/union-transparent.test
new file mode 100644
index 000000000..d2e8e160a
--- /dev/null
+++ b/tests/gir/union-transparent.test
@@ -0,0 +1,30 @@
+GIR
+
+Input:
+
+<record name="Foo" c:type="TestFoo">
+ <field name="u" writable="1">
+ <type name="guint" c:type="guint"/>
+ </field>
+ <union>
+ <field name="a" writable="1">
+ <array zero-terminated="0" fixed-size="2">
+ <type name="int" c:type="int*"/>
+ </array>
+ </field>
+ <field name="pad" readable="0" private="1">
+ <array zero-terminated="0" fixed-size="4">
+ <type name="guint" c:type="guint"/>
+ </array>
+ </field>
+ </union>
+</record>
+
+Output:
+
+[CCode (cheader_filename = "test.h", has_type_id = false)]
+public struct Foo {
+ public uint u;
+ [CCode (array_length = false)]
+ public weak int a[2];
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]