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



commit 98d7546d227b5a67f4b1ecb0e0be560a2a397b94
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 17 07:45:16 2019 +0200

    tests: Extent "girwriter" test to increase coverage

 tests/girwriter/GirTest-1.0.gir-expected | 107 +++++++++++++++++++++++++++++++
 tests/girwriter/girtest.vala             |  14 ++++
 tests/girwriter/girtest.vapi-expected    |  11 ++++
 3 files changed, 132 insertions(+)
---
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 387df18ae..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"/>
@@ -1411,6 +1513,11 @@
                        </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"/>
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 7673706d9..e9b3d2ae1 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -79,6 +79,8 @@ 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)]
@@ -121,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;
                }
@@ -234,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;
                }
@@ -269,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 {
        }
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index 854c2cfd5..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 ();
@@ -42,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);
@@ -52,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);
@@ -163,6 +172,8 @@ 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);


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