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



commit fca559e4b8293e3de535b6e28fc2d9ef942804f0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Feb 26 14:01:53 2019 +0100

    tests: Extent "girwriter" test to increase coverage

 tests/girwriter/GirTest-1.0.gir-expected | 146 +++++++++++++++++++++++++++++++
 tests/girwriter/girtest.vala             |  19 ++++
 tests/girwriter/girtest.vapi-expected    |   6 ++
 3 files changed, 171 insertions(+)
---
diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected
index 72705c6fd..052868bb6 100644
--- a/tests/girwriter/GirTest-1.0.gir-expected
+++ b/tests/girwriter/GirTest-1.0.gir-expected
@@ -49,6 +49,14 @@
                <field name="field">
                        <type name="gint" c:type="gint"/>
                </field>
+               <field name="fixed_array_field">
+                       <array fixed-size="23" c:type="gint*">
+                               <type name="gint" c:type="gint"/>
+                       </array>
+               </field>
+               <field name="nullable_field" allow-none="1">
+                       <type name="utf8" c:type="gchar*"/>
+               </field>
                <constructor name="new" c:identifier="gir_test_object_test_new">
                        <return-value transfer-ownership="full">
                                <type name="GirTest.ObjectTest" c:type="GirTestObjectTest*"/>
@@ -412,6 +420,25 @@
                        <parameters>
                        </parameters>
                </method>
+               <method name="container_return" c:identifier="gir_test_object_test_container_return">
+                       <return-value transfer-ownership="container">
+                               <array length="0" c:type="const gchar**">
+                                       <type name="utf8" c:type="const gchar*"/>
+                               </array>
+                       </return-value>
+                       <parameters>
+                               <parameter name="result_length1" direction="out" transfer-ownership="none">
+                                       <type name="gint" c:type="gint*"/>
+                               </parameter>
+                       </parameters>
+               </method>
+               <method name="generic_array_container_return" 
c:identifier="gir_test_object_test_generic_array_container_return">
+                       <return-value transfer-ownership="container" allow-none="1">
+                               <array name="GLib.PtrArray" c:type="GPtrArray*">
+                                       <type name="utf8" c:type="const gchar*"/>
+                               </array>
+                       </return-value>
+               </method>
                <method name="coroutine_async" c:identifier="gir_test_object_test_coroutine_async">
                        <return-value transfer-ownership="none">
                                <type name="none"/>
@@ -435,6 +462,64 @@
                                </parameter>
                        </parameters>
                </method>
+               <method name="coroutine_method_throw" 
c:identifier="gir_test_object_test_coroutine_method_throw">
+                       <return-value transfer-ownership="none">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="i1" transfer-ownership="none">
+                                       <type name="gint" c:type="gint"/>
+                               </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>
+               </method>
+               <method name="coroutine_method_throw_finish" 
c:identifier="gir_test_object_test_coroutine_method_throw_finish" throws="1">
+                       <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>
+                               <parameter name="o1" direction="out" transfer-ownership="full">
+                                       <type name="gint" c:type="gint*"/>
+                               </parameter>
+                       </parameters>
+               </method>
+               <virtual-method name="coroutine_method_throw" invoker="coroutine_method_throw">
+                       <return-value transfer-ownership="none">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="i1" transfer-ownership="none">
+                                       <type name="gint" c:type="gint"/>
+                               </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>
+               </virtual-method>
+               <virtual-method name="coroutine_method_throw_finish" invoker="coroutine_method_throw_finish" 
throws="1">
+                       <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>
+                               <parameter name="o1" direction="out" transfer-ownership="full">
+                                       <type name="gint" c:type="gint*"/>
+                               </parameter>
+                       </parameters>
+               </virtual-method>
                <method name="simple_throw" c:identifier="gir_test_object_test_simple_throw" throws="1">
                        <return-value transfer-ownership="full">
                                <type name="none"/>
@@ -527,6 +612,16 @@
                                </parameter>
                        </parameters>
                </glib:signal>
+               <glib:signal name="signal-with-default-handlder">
+                       <return-value transfer-ownership="full">
+                               <type name="none"/>
+                       </return-value>
+                       <parameters>
+                               <parameter name="i1" transfer-ownership="none">
+                                       <type name="gint" c:type="gint"/>
+                               </parameter>
+                       </parameters>
+               </glib:signal>
        </class>
        <record name="ObjectTestClass" c:type="GirTestObjectTestClass" glib:is-gtype-struct-for="ObjectTest">
                <field name="parent_class">
@@ -547,6 +642,45 @@
                                </parameters>
                        </callback>
                </field>
+               <field name="coroutine_method_throw">
+                       <callback name="coroutine_method_throw" c:type="coroutine_method_throw">
+                               <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="i1" transfer-ownership="none">
+                                               <type name="gint" c:type="gint"/>
+                                       </parameter>
+                                       <parameter name="_callback_" transfer-ownership="none" allow-none="1" 
closure="3" 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_method_throw_finish">
+                       <callback name="coroutine_method_throw_finish" c:type="coroutine_method_throw_finish" 
throws="1">
+                               <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>
+                                       <parameter name="o1" direction="out" transfer-ownership="full">
+                                               <type name="gint" c:type="gint*"/>
+                                       </parameter>
+                               </parameters>
+                       </callback>
+               </field>
                <field name="method_throw">
                        <callback name="method_throw" c:type="method_throw" throws="1">
                                <return-value transfer-ownership="full">
@@ -559,6 +693,18 @@
                                </parameters>
                        </callback>
                </field>
+               <field name="signal_with_default_handlder">
+                       <callback name="object_test_signal_with_default_handlder" 
c:type="object_test_signal_with_default_handlder">
+                               <return-value transfer-ownership="full">
+                                       <type name="none"/>
+                               </return-value>
+                               <parameters>
+                                       <parameter name="i1" transfer-ownership="none">
+                                               <type name="gint" c:type="gint"/>
+                                       </parameter>
+                               </parameters>
+                       </callback>
+               </field>
        </record>
        <record name="ObjectTestPrivate" c:type="GirTestObjectTestPrivate" disguised="1"/>
        <class name="AbstractObjectTest" c:type="GirTestAbstractObjectTest" 
glib:type-name="GirTestAbstractObjectTest" glib:get-type="gir_test_abstract_object_test_get_type" 
glib:type-struct="AbstractObjectTestClass" parent="GObject.Object" abstract="1">
diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala
index 4f04d9296..36fef0cb5 100644
--- a/tests/girwriter/girtest.vala
+++ b/tests/girwriter/girtest.vala
@@ -91,6 +91,10 @@ namespace GirTest {
 
                public int field = 42;
 
+               public int fixed_array_field[23];
+
+               public string? nullable_field;
+
                public string some_property { get; construct set; }
 
                public string write_only_property { set; }
@@ -207,15 +211,30 @@ namespace GirTest {
                        return str_equal;
                }
 
+               public (unowned string)[] container_return () {
+                       return { "foo", "bar" };
+               }
+
+               public GenericArray<unowned string>? generic_array_container_return () {
+                       return null;
+               }
+
                public async void coroutine_async () {
                }
 
+               public virtual async void coroutine_method_throw (int i1, out int o1) throws ErrorTest {
+                       o1 = i1;
+               }
+
                public void simple_throw () throws ErrorTest {
                }
 
                public virtual void method_throw () throws ErrorTest {
                }
 
+               public virtual signal void signal_with_default_handlder (int i1) {
+               }
+
                [GIR (visible = false)]
                public void skipped_method () {
                }
diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected
index d89338f8e..0612f09ff 100644
--- a/tests/girwriter/girtest.vapi-expected
+++ b/tests/girwriter/girtest.vapi-expected
@@ -20,18 +20,23 @@ namespace GirTest {
        [CCode (cheader_filename = "girtest.h")]
        public class ObjectTest : GLib.Object {
                public int field;
+               public int fixed_array_field[23];
+               public string? nullable_field;
                public ObjectTest ();
                public void array_in (int[] array);
                public void array_inout (ref int[] array);
                public void array_out (out int[] array);
                public int[] array_return ();
                public int[] array_return_int_in_delegate_out (int i1, out GirTest.DelegateTest d);
+               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 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);
                public static void full_out (out GirTest.ObjectTest obj);
                public static GirTest.ObjectTest full_return ();
+               public GLib.GenericArray<weak string>? generic_array_container_return ();
                public void int8_in (int8 param);
                public void int8_out (out int8 param);
                public void int_in_int_in_array_out (int param1, int param2, out int[] array);
@@ -60,6 +65,7 @@ namespace GirTest {
                public string skipped_property { get; set construct; }
                public string some_property { get; set construct; }
                public string write_only_property { set; }
+               public virtual signal void signal_with_default_handlder (int i1);
                [GIR (visible = false)]
                public signal void skipped_signal (int param);
                public signal void some_signal (int param);


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