From: Rico Tzschichholz Date: Thu, 8 Feb 2018 21:06:49 +0000 (+0100) Subject: tests: Add some "girparser" tests to increase coverage X-Git-Tag: 0.39.91~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2189d6e6e7b0f6778bb99c4d3aca381a40866c10;p=thirdparty%2Fvala.git tests: Add some "girparser" tests to increase coverage --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 37e882108..7b9d57c53 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -368,8 +368,13 @@ TESTS = \ gir/bug667751.test \ gir/bug742012.test \ gir/bug788775.test \ + gir/bug792998.test \ gir/array-fixed-length.test \ + gir/class.test \ gir/delegate-alias-without-target.test \ + gir/delegate-closure-destroy-index-conflict.test \ + gir/parameter-nullable-out-simple-type.test \ + gir/property-non-readable.test \ annotations/deprecated.vala \ annotations/description.vala \ annotations/noaccessormethod.test \ diff --git a/tests/gir/bug792998.test b/tests/gir/bug792998.test new file mode 100644 index 000000000..ca4b18ac1 --- /dev/null +++ b/tests/gir/bug792998.test @@ -0,0 +1,59 @@ +GIR + +Input: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Output: + +[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")] +public class Foo : GLib.Object { + [CCode (has_construct_function = false)] + protected Foo (); + public int get_prop1 () throws GLib.Error; + public int get_prop2 (); + public void set_prop1 (int value); + public bool set_prop2 (int i) throws GLib.Error; + [NoAccessorMethod] + public int prop1 { get; set; } + [NoAccessorMethod] + public int prop2 { get; set; } +} diff --git a/tests/gir/class.test b/tests/gir/class.test new file mode 100644 index 000000000..578c0b82e --- /dev/null +++ b/tests/gir/class.test @@ -0,0 +1,146 @@ +GIR + +Input: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Output: + +[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")] +public class Foo : GLib.Object, Test.IFoo { + [CCode (has_construct_function = false)] + public Foo (); + [CCode (cname = "test_foo_new_bar", has_construct_function = false)] + public Foo.bar (); + public string get_prop (); + public async void method_async (string input, out string output) throws GLib.Error; + public virtual void method_virtual () throws GLib.Error; + public void set_prop (string value); + public string prop { owned get; set construct; } + public signal void sig (string arg); +} +[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/delegate-closure-destroy-index-conflict.test b/tests/gir/delegate-closure-destroy-index-conflict.test new file mode 100644 index 000000000..4bf57bfa6 --- /dev/null +++ b/tests/gir/delegate-closure-destroy-index-conflict.test @@ -0,0 +1,25 @@ +GIR + +Input: + + + + + + + + + + + + + + + + + + +Output: + +[CCode (cheader_filename = "test.h")] +public static void function (owned GLib.Func? callback); diff --git a/tests/gir/parameter-nullable-out-simple-type.test b/tests/gir/parameter-nullable-out-simple-type.test new file mode 100644 index 000000000..b444368f2 --- /dev/null +++ b/tests/gir/parameter-nullable-out-simple-type.test @@ -0,0 +1,19 @@ +GIR + +Input: + + + + + + + + + + + + +Output: + +[CCode (cheader_filename = "test.h")] +public static void function (out int i); diff --git a/tests/gir/property-non-readable.test b/tests/gir/property-non-readable.test new file mode 100644 index 000000000..0816a4d75 --- /dev/null +++ b/tests/gir/property-non-readable.test @@ -0,0 +1,20 @@ +GIR + +Input: + + + + + + + + +Output: + +[CCode (cheader_filename = "test.h", type_id = "test_foo_get_type ()")] +public class Foo : GLib.Object { + [CCode (has_construct_function = false)] + protected Foo (); + [NoAccessorMethod] + public int prop { construct; } +}