[vala/0.44] tests: Extent "girwriter" test to increase coverage



commit 9d8d5001ca2b07ff280d017a9e8e976339585aa9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Oct 16 19:16:20 2019 +0200

    tests: Extent "girwriter" test to increase coverage

 tests/girwriter/GirTest-1.0.gir-expected | 175 +++++++++++++++++++++++++++++++
 tests/girwriter/girtest.vala             |  19 ++++
 tests/girwriter/girtest.vapi-expected    |  14 +++
 3 files changed, 208 insertions(+)
---
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 034f48418..a03f48fc6 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -137,6 +137,16 @@
                                </parameter>
                        </parameters>
                </constructor>
+               <constructor name="may_fail" c:identifier="gir_test_object_test_new_may_fail" throws="1">
+                       <return-value transfer-ownership="full">
+                               <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="param" transfer-ownership="none">
+                                       <type name="gint" c:type="gint"/>
+                               </parameter>
+                       </parameters>
+               </constructor>
                <constructor name="newv" c:identifier="gir_test_object_test_new_newv" introspectable="0">
                        <return-value transfer-ownership="full">
                                <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
@@ -527,6 +537,52 @@
                                </parameter>
                        </parameters>
                </method>
+               <method name="coroutine_virtual_async" 
c:identifier="gir_test_object_test_coroutine_virtual_async">
+                       <return-value transfer-ownership="none">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="_callback_" transfer-ownership="none" allow-none="1" 
closure="1" scope="async">
+                                       <type name="Gio.AsyncReadyCallback" c:type="GAsyncReadyCallback"/>
+                               </parameter>
+                               <parameter name="_callback__target" transfer-ownership="none" allow-none="1">
+                                       <type name="gpointer" c:type="void*"/>
+                               </parameter>
+                       </parameters>
+               </method>
+               <method name="coroutine_virtual_finish" 
c:identifier="gir_test_object_test_coroutine_virtual_finish">
+                       <return-value transfer-ownership="full">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="_res_" transfer-ownership="none">
+                                       <type name="Gio.AsyncResult" c:type="GAsyncResult*"/>
+                               </parameter>
+                       </parameters>
+               </method>
+               <virtual-method name="coroutine_virtual_async" invoker="coroutine_virtual_async">
+                       <return-value transfer-ownership="none">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="_callback_" transfer-ownership="none" allow-none="1" 
closure="1" scope="async">
+                                       <type name="Gio.AsyncReadyCallback" c:type="GAsyncReadyCallback"/>
+                               </parameter>
+                               <parameter name="_callback__target" transfer-ownership="none" allow-none="1">
+                                       <type name="gpointer" c:type="void*"/>
+                               </parameter>
+                       </parameters>
+               </virtual-method>
+               <virtual-method name="coroutine_virtual_finish" invoker="coroutine_virtual_finish">
+                       <return-value transfer-ownership="full">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="_res_" transfer-ownership="none">
+                                       <type name="Gio.AsyncResult" c:type="GAsyncResult*"/>
+                               </parameter>
+                       </parameters>
+               </virtual-method>
                <method name="coroutine_method_throw" 
c:identifier="gir_test_object_test_coroutine_method_throw">
                        <return-value transfer-ownership="none">
                                <type name="none"/>
@@ -707,6 +763,39 @@
                                </parameters>
                        </callback>
                </field>
+               <field name="coroutine_virtual_async">
+                       <callback name="coroutine_virtual_async" c:type="coroutine_virtual_async">
+                               <return-value transfer-ownership="none">
+                                       <type name="none"/>
+                               </return-value>
+                               <parameters>
+                                       <parameter name="self" transfer-ownership="none">
+                                               <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
+                                       </parameter>
+                                       <parameter name="_callback_" transfer-ownership="none" allow-none="1" 
closure="2" scope="async">
+                                               <type name="Gio.AsyncReadyCallback" 
c:type="GAsyncReadyCallback"/>
+                                       </parameter>
+                                       <parameter name="_callback__target" transfer-ownership="none" 
allow-none="1">
+                                               <type name="gpointer" c:type="void*"/>
+                                       </parameter>
+                               </parameters>
+                       </callback>
+               </field>
+               <field name="coroutine_virtual_finish">
+                       <callback name="coroutine_virtual_finish" c:type="coroutine_virtual_finish">
+                               <return-value transfer-ownership="full">
+                                       <type name="none"/>
+                               </return-value>
+                               <parameters>
+                                       <parameter name="self" transfer-ownership="none">
+                                               <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
+                                       </parameter>
+                                       <parameter name="_res_" transfer-ownership="none">
+                                               <type name="Gio.AsyncResult" c:type="GAsyncResult*"/>
+                                       </parameter>
+                               </parameters>
+                       </callback>
+               </field>
                <field name="coroutine_method_throw">
                        <callback name="coroutine_method_throw" c:type="coroutine_method_throw">
                                <return-value transfer-ownership="none">
@@ -933,6 +1022,19 @@
                </field>
        </record>
        <record name="ImplementionTestPrivate" c:type="GirTestImplementionTestPrivate" disguised="1"/>
+       <record name="CompactClass">
+               <field name="s">
+                       <type name="utf8" c:type="gchar*"/>
+               </field>
+               <field name="i">
+                       <type name="gint" c:type="gint"/>
+               </field>
+               <constructor name="new" c:identifier="gir_test_compactclass_new">
+                       <return-value transfer-ownership="full">
+                               <type name="GirTest.CompactClass" c:type="GirTestCompactClass*"/>
+                       </return-value>
+               </constructor>
+       </record>
        <class name="SkippedClass" c:type="GirTestSkippedClass" glib:type-name="GirTestSkippedClass" 
glib:get-type="gir_test_skippedclass_get_type" glib:type-struct="SkippedClassClass" glib:fundamental="1" 
glib:ref-func="gir_test_skippedclass_ref" glib:unref-func="gir_test_skippedclass_unref" 
glib:set-value-func="gir_test_value_set_skippedclass" glib:get-value-func="gir_test_value_get_skippedclass" 
introspectable="0">
                <field name="parent_instance">
                        <type name="GObject.TypeInstance" c:type="GTypeInstance"/>
@@ -1021,6 +1123,40 @@
                                </parameter>
                        </parameters>
                </constructor>
+               <constructor name="typed" c:identifier="gir_test_generics_test_new_typed">
+                       <return-value transfer-ownership="full">
+                               <type name="GirTest.GenericsTest" c:type="GirTestGenericsTest*"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="g_type" transfer-ownership="none">
+                                       <type name="GType" c:type="GType"/>
+                               </parameter>
+                               <parameter name="g_dup_func" transfer-ownership="none">
+                                       <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+                               </parameter>
+                               <parameter name="g_destroy_func" transfer-ownership="none">
+                                       <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+                               </parameter>
+                               <parameter name="t_type" transfer-ownership="none">
+                                       <type name="GType" c:type="GType"/>
+                               </parameter>
+                               <parameter name="t_dup_func" transfer-ownership="none">
+                                       <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+                               </parameter>
+                               <parameter name="t_destroy_func" transfer-ownership="none">
+                                       <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+                               </parameter>
+                               <parameter name="cb" transfer-ownership="none" closure="7" scope="notified" 
destroy="8">
+                                       <type name="GirTest.DelegateGenericsTest" 
c:type="GirTestDelegateGenericsTest"/>
+                               </parameter>
+                               <parameter name="cb_target" transfer-ownership="none" allow-none="1">
+                                       <type name="gpointer" c:type="void*"/>
+                               </parameter>
+                               <parameter name="cb_target_destroy_notify" transfer-ownership="none" 
scope="call">
+                                       <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+                               </parameter>
+                       </parameters>
+               </constructor>
                <method name="method" c:identifier="gir_test_generics_test_method">
                        <return-value transfer-ownership="full">
                                <type name="none"/>
@@ -1377,6 +1513,45 @@
                        </parameter>
                </parameters>
        </callback>
+       <callback name="DelegateErrorTest" c:type="GirTestDelegateErrorTest" throws="1">
+               <return-value transfer-ownership="full">
+                       <type name="gboolean" c:type="gboolean"/>
+               </return-value>
+       </callback>
+       <callback name="DelegateGenericsTest" c:type="GirTestDelegateGenericsTest">
+               <return-value transfer-ownership="full">
+                       <type name="gboolean" c:type="gboolean"/>
+               </return-value>
+               <parameters>
+                       <parameter name="g_type" transfer-ownership="none">
+                               <type name="GType" c:type="GType"/>
+                       </parameter>
+                       <parameter name="g_dup_func" transfer-ownership="none">
+                               <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+                       </parameter>
+                       <parameter name="g_destroy_func" transfer-ownership="none">
+                               <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+                       </parameter>
+                       <parameter name="t_type" transfer-ownership="none">
+                               <type name="GType" c:type="GType"/>
+                       </parameter>
+                       <parameter name="t_dup_func" transfer-ownership="none">
+                               <type name="GObject.BoxedCopyFunc" c:type="GBoxedCopyFunc"/>
+                       </parameter>
+                       <parameter name="t_destroy_func" transfer-ownership="none">
+                               <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/>
+                       </parameter>
+                       <parameter name="g" transfer-ownership="none" allow-none="1">
+                               <type name="gpointer" c:type="gpointer"/>
+                       </parameter>
+                       <parameter name="t" transfer-ownership="none" allow-none="1">
+                               <type name="gpointer" c:type="gpointer"/>
+                       </parameter>
+                       <parameter name="user_data" transfer-ownership="none" closure="8">
+                               <type name="gpointer" c:type="void*"/>
+                       </parameter>
+               </parameters>
+       </callback>
        <callback name="SkippedDelegate" c:type="GirTestSkippedDelegate" introspectable="0">
                <return-value transfer-ownership="full">
                        <type name="none"/>
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 3ace08a5b..e9b3d2ae1 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -79,6 +79,10 @@ namespace GirTest {
 
        public delegate bool DelegateTest (void* a, void* b);
 
+       public delegate bool DelegateErrorTest () throws ErrorTest;
+
+       public delegate bool DelegateGenericsTest<G,T> (G g, T t);
+
        [GIR (visible = false)]
        public delegate void SkippedDelegate ();
 
@@ -119,6 +123,9 @@ namespace GirTest {
                public ObjectTest.with_int (int param) {
                        field = param;
                }
+               public ObjectTest.may_fail (int param) throws ErrorTest {
+                       field = param;
+               }
                public ObjectTest.newv (int param, ...) {
                        field = param;
                }
@@ -232,6 +239,9 @@ namespace GirTest {
                public async void coroutine_async () {
                }
 
+               public virtual async void coroutine_virtual_async () {
+               }
+
                public virtual async void coroutine_method_throw (int i1, out int o1) throws ErrorTest {
                        o1 = i1;
                }
@@ -267,6 +277,12 @@ namespace GirTest {
                public int property { get; construct set; }
        }
 
+       [Compact]
+       public class CompactClass {
+               public string s;
+               public int i;
+       }
+
        [GIR (visible = false)]
        public class SkippedClass {
        }
@@ -279,6 +295,9 @@ namespace GirTest {
                public GenericsTest (owned DelegateTest cb) {
                }
 
+               public GenericsTest.typed (owned DelegateGenericsTest<G,T> cb) {
+               }
+
                public void method (T param) {
                }
        }
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index 52d23d16a..f92e00d05 100644
--- a/tests/girwriter/girtest.vapi-expected
+++ b/tests/girwriter/girtest.vapi-expected
@@ -9,6 +9,13 @@ namespace GirTest {
                public abstract void method_throw () throws GirTest.ErrorTest;
        }
        [CCode (cheader_filename = "girtest.h")]
+       [Compact]
+       public class CompactClass {
+               public int i;
+               public string s;
+               public CompactClass ();
+       }
+       [CCode (cheader_filename = "girtest.h")]
        [Version (deprecated = true, deprecated_since = "0.1.2", since = "0.1.0")]
        public class DeprecatedClassTest {
                public DeprecatedClassTest ();
@@ -22,6 +29,7 @@ namespace GirTest {
        public class GenericsTest<G,T> {
                public GenericsTest (owned GirTest.DelegateTest cb);
                public void method (T param);
+               public GenericsTest.typed (owned GirTest.DelegateGenericsTest<G,T> cb);
        }
        [CCode (cheader_filename = "girtest.h")]
        public class ImplementionTest : GLib.Object, GirTest.InterfaceTest {
@@ -41,6 +49,7 @@ namespace GirTest {
                public (unowned string)[] container_return ();
                public async void coroutine_async ();
                public virtual async void coroutine_method_throw (int i1, out int o1) throws 
GirTest.ErrorTest;
+               public virtual async void coroutine_virtual_async ();
                public GirTest.DelegateTest delegate_return ();
                public GirTest.DelegateTest delegate_return_int_in_array_out (int i1, out int[] a);
                public static void full_inout (ref GirTest.ObjectTest obj);
@@ -51,6 +60,7 @@ namespace GirTest {
                public void int8_out (out int8 param);
                public void int_in_int_in_array_out (int param1, int param2, out int[] array);
                public int[] int_in_int_in_array_return (int param1, int param2);
+               public ObjectTest.may_fail (int param) throws GirTest.ErrorTest;
                public void method ();
                public virtual void method_throw () throws GirTest.ErrorTest;
                public void method_valist (int param, va_list vargs);
@@ -162,6 +172,10 @@ namespace GirTest {
                FISHY
        }
        [CCode (cheader_filename = "girtest.h")]
+       public delegate bool DelegateErrorTest () throws GirTest.ErrorTest;
+       [CCode (cheader_filename = "girtest.h")]
+       public delegate bool DelegateGenericsTest<G,T> (G g, T t);
+       [CCode (cheader_filename = "girtest.h")]
        public delegate bool DelegateTest (void* a, void* b);
        [CCode (cheader_filename = "girtest.h")]
        [GIR (visible = false)]


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