From: Rico Tzschichholz Date: Mon, 24 Sep 2018 13:29:15 +0000 (+0200) Subject: tests: Extent "girwriter" test to increase coverage X-Git-Tag: 0.43.1~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81658eb90c012aa1cff247bce11bfcbe10621d18;p=thirdparty%2Fvala.git tests: Extent "girwriter" test to increase coverage --- diff --git a/tests/girwriter/GirTest-1.0.gir-expected b/tests/girwriter/GirTest-1.0.gir-expected index 02edb2aa7..18f275596 100644 --- a/tests/girwriter/GirTest-1.0.gir-expected +++ b/tests/girwriter/GirTest-1.0.gir-expected @@ -2,13 +2,14 @@ + - + - + @@ -21,6 +22,11 @@ + + + + + @@ -301,6 +307,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -374,11 +407,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -419,6 +542,18 @@ + + + + + + + + + + + + @@ -488,6 +623,16 @@ + + + + + + + + + + @@ -538,8 +683,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -547,7 +724,15 @@ + + + + + + + + @@ -568,6 +753,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -588,6 +852,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -596,6 +920,14 @@ + + + + + + + + diff --git a/tests/girwriter/Makefile.am b/tests/girwriter/Makefile.am index c674d7d23..7f7a0e048 100644 --- a/tests/girwriter/Makefile.am +++ b/tests/girwriter/Makefile.am @@ -5,8 +5,10 @@ check-girwriter: $(top_builddir)/compiler/valac -C \ --disable-version-header \ --vapidir $(top_srcdir)/vapi \ + --pkg gio-2.0 \ --gir GirTest-1.0.gir \ --library girtest \ + --shared-library girtest \ $(srcdir)/girtest.vala; \ tail -n +3 girtest.vapi | diff -wu $(srcdir)/girtest.vapi-expected - || exit 1; \ diff -wu $(srcdir)/GirTest-1.0.gir-expected GirTest-1.0.gir || exit 1; \ diff --git a/tests/girwriter/girtest.vala b/tests/girwriter/girtest.vala index c5d4f928b..806b3312a 100644 --- a/tests/girwriter/girtest.vala +++ b/tests/girwriter/girtest.vala @@ -20,7 +20,7 @@ namespace GirTest { public enum EnumTest { VALUE1, VALUE2, - VALUE3 + VALUE3 = 4711 } [Flags] @@ -40,9 +40,18 @@ namespace GirTest { VALUE1 } - public interface InterfaceTest { + public errordomain ErrorTest { + FAILED, + SMELLY, + FISHY = 23 + } + + public interface InterfaceTest : Object { + public abstract int property { get; construct set; } public virtual void int8_in (int8 param) { } + public virtual async void coroutine_async () { + } } [GIR (visible = false)] @@ -63,6 +72,16 @@ namespace GirTest { public signal void skipped_signal (int param); public int field = 42; + + public string some_property { get; construct set; } + + public string write_only_property { set; } + + public string construct_only_property { construct; } + + [GIR (visible = false)] + public string skipped_property { get; construct set; } + public ObjectTest () { } public ObjectTest.with_int (int param) { @@ -141,6 +160,14 @@ namespace GirTest { return new int[8]; } + public void string_array_out (out string[] array) { + array = { "foo" }; + } + + public string[] string_array_return () { + return { "foo" }; + } + public void none_in () { } @@ -162,6 +189,15 @@ namespace GirTest { return str_equal; } + public async void coroutine_async () { + } + + public void simple_throw () throws ErrorTest { + } + + public virtual void method_throw () throws ErrorTest { + } + [GIR (visible = false)] public void skipped_method () { } @@ -173,9 +209,22 @@ namespace GirTest { public abstract void method_int8_inout (ref int8 param); public abstract void method_int8_out (out int8 param); + + public abstract void method_throw () throws ErrorTest; + } + + public interface PrerequisiteTest : InterfaceTest { + } + + public class ImplementionTest : Object, InterfaceTest { + public int property { get; construct set; } } [GIR (visible = false)] public class SkippedClass { } + + [Version (deprecated = true, deprecated_since = "0.1.2", since = "0.1.0")] + public class DeprecatedClassTest { + } } diff --git a/tests/girwriter/girtest.vapi-expected b/tests/girwriter/girtest.vapi-expected index b6b37542e..2b5a9a466 100644 --- a/tests/girwriter/girtest.vapi-expected +++ b/tests/girwriter/girtest.vapi-expected @@ -6,6 +6,16 @@ namespace GirTest { public abstract void method_int8_in (int8 param); public abstract void method_int8_inout (ref int8 param); public abstract void method_int8_out (out int8 param); + public abstract void method_throw () throws GirTest.ErrorTest; + } + [CCode (cheader_filename = "girtest.h")] + [Version (deprecated = true, deprecated_since = "0.1.2", since = "0.1.0")] + public class DeprecatedClassTest { + public DeprecatedClassTest (); + } + [CCode (cheader_filename = "girtest.h")] + public class ImplementionTest : GLib.Object, GirTest.InterfaceTest { + public ImplementionTest (); } [CCode (cheader_filename = "girtest.h")] public class ObjectTest : GLib.Object { @@ -16,6 +26,7 @@ namespace GirTest { 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 async void coroutine_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); @@ -26,6 +37,7 @@ namespace GirTest { 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 void method (); + public virtual void method_throw () throws GirTest.ErrorTest; public void method_valist (int param, va_list vargs); public void method_varargs (int param, ...); public virtual void method_with_default_impl (int8 param); @@ -36,10 +48,18 @@ namespace GirTest { public static void none_out (out unowned GirTest.ObjectTest obj); public static unowned GirTest.ObjectTest none_return (); public GLib.EqualFunc simple_delegate_return (); + public void simple_throw () throws GirTest.ErrorTest; [GIR (visible = false)] public void skipped_method (); public static void static_method (); + public void string_array_out (out string[] array); + public string[] string_array_return (); public ObjectTest.with_int (int param); + public string construct_only_property { construct; } + [GIR (visible = false)] + public string skipped_property { get; set construct; } + public string some_property { get; set construct; } + public string write_only_property { set; } [GIR (visible = false)] public signal void skipped_signal (int param); public signal void some_signal (int param); @@ -55,8 +75,13 @@ namespace GirTest { public SkippedStruct (); } [CCode (cheader_filename = "girtest.h")] - public interface InterfaceTest { + public interface InterfaceTest : GLib.Object { + public virtual async void coroutine_async (); public virtual void int8_in (int8 param); + public abstract int property { get; set construct; } + } + [CCode (cheader_filename = "girtest.h")] + public interface PrerequisiteTest : GirTest.InterfaceTest { } [CCode (cheader_filename = "girtest.h")] [GIR (visible = false)] @@ -92,6 +117,12 @@ namespace GirTest { VALUE1 } [CCode (cheader_filename = "girtest.h")] + public errordomain ErrorTest { + FAILED, + SMELLY, + FISHY + } + [CCode (cheader_filename = "girtest.h")] public delegate bool DelegateTest (void* a, void* b); [CCode (cheader_filename = "girtest.h")] [GIR (visible = false)]