From: Rico Tzschichholz Date: Thu, 18 Apr 2019 14:28:43 +0000 (+0200) Subject: tests: Add "fast-vapi" test to increase coverage X-Git-Tag: 0.45.1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5fbd6c7ec6e085b0f741760bf4843409ae25fc4;p=thirdparty%2Fvala.git tests: Add "fast-vapi" test to increase coverage --- diff --git a/configure.ac b/configure.ac index 8de8b933b..aa8097b23 100644 --- a/configure.ac +++ b/configure.ac @@ -221,6 +221,7 @@ AC_CONFIG_FILES([Makefile compiler/Makefile vapi/Makefile tests/Makefile + tests/fastvapi/Makefile tests/girwriter/Makefile tests/gtktemplate/Makefile doc/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index e61c65b18..456761ea6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,7 @@ NULL = SUBDIRS = \ + fastvapi \ girwriter \ gtktemplate \ $(NULL) diff --git a/tests/fastvapi/Makefile.am b/tests/fastvapi/Makefile.am new file mode 100644 index 000000000..e58523ba4 --- /dev/null +++ b/tests/fastvapi/Makefile.am @@ -0,0 +1,22 @@ +NULL = + +check-fastvapi: $(top_builddir)/compiler/valac + G_DEBUG=fatal-warnings $(top_builddir)/compiler/valac \ + -C \ + --disable-version-header \ + --fast-vapi fastvapitest.vapi \ + $(srcdir)/fastvapitest.vala; \ + tail -n +3 fastvapitest.vapi | diff -wu $(srcdir)/fastvapitest.vapi-expected - || exit 1; \ + rm -f fastvapitest.vapi fastvapitest.c + +check: check-fastvapi + +EXTRA_DIST = \ + fastvapitest.vala \ + fastvapitest.vapi-expected \ + $(NULL) + +CLEANFILES = \ + fastvapitest.c \ + fastvapitest.vapi \ + $(NULL) diff --git a/tests/fastvapi/fastvapitest.vala b/tests/fastvapi/fastvapitest.vala new file mode 100644 index 000000000..02025e307 --- /dev/null +++ b/tests/fastvapi/fastvapitest.vala @@ -0,0 +1,36 @@ +namespace FastVapi { + public const int CONSTANT = 42; + + public enum EnumTest { + VALUE + } + + public errordomain ErrorTest { + FAILED + } + + public struct TestStruct { + public int field_name; + } + + public interface InterfaceTest : Object { + public abstract int property { get; construct set; } + public abstract void method (int param); + } + + public delegate bool DelegateTest (int param); + + public class Test : Object { + public signal void some_signal (int param); + + public int field; + + public string property { get; construct set; } + + public Test () { + } + + public void method () { + } + } +} diff --git a/tests/fastvapi/fastvapitest.vapi-expected b/tests/fastvapi/fastvapitest.vapi-expected new file mode 100644 index 000000000..55540ab08 --- /dev/null +++ b/tests/fastvapi/fastvapitest.vapi-expected @@ -0,0 +1,44 @@ +using GLib; + +[Source (filename = "./fastvapitest.vala", line = 1, column = 1)] +namespace FastVapi { + [Source (filename = "./fastvapitest.vala", line = 23, column = 2)] + public class Test : Object { + [Source (filename = "./fastvapitest.vala", line = 26, column = 3)] + public int field; + [Source (filename = "./fastvapitest.vala", line = 30, column = 3)] + public Test (); + [Source (filename = "./fastvapitest.vala", line = 33, column = 3)] + public void method (); + [Source (filename = "./fastvapitest.vala", line = 28, column = 3)] + public string property { get; set construct; } + [Source (filename = "./fastvapitest.vala", line = 24, column = 3)] + public signal void some_signal (int param); + } + [Source (filename = "./fastvapitest.vala", line = 16, column = 2)] + public interface InterfaceTest : Object { + [Source (filename = "./fastvapitest.vala", line = 18, column = 3)] + public abstract void method (int param); + [Source (filename = "./fastvapitest.vala", line = 17, column = 3)] + public abstract int property { get; set construct; } + } + [Source (filename = "./fastvapitest.vala", line = 12, column = 2)] + public struct TestStruct { + [Source (filename = "./fastvapitest.vala", line = 13, column = 3)] + public int field_name; + } + [Source (filename = "./fastvapitest.vala", line = 4, column = 2)] + public enum EnumTest { + [Source (filename = "./fastvapitest.vala", line = 5, column = 3)] + VALUE + } + [Source (filename = "./fastvapitest.vala", line = 8, column = 2)] + public errordomain ErrorTest { + [Source (filename = "./fastvapitest.vala", line = 9, column = 3)] + FAILED + } + [Source (filename = "./fastvapitest.vala", line = 21, column = 2)] + public delegate bool DelegateTest (int param); + [Source (filename = "./fastvapitest.vala", line = 2, column = 2)] + public const int CONSTANT = 42; +}