]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "ModuleInit" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 23 Feb 2019 19:19:31 +0000 (20:19 +0100)
tests/Makefile.am
tests/objects/plugin-module-init.vala [new file with mode: 0644]

index 178b897dc459032836dd04e59b5ade1b5d9bcfb0..4b6bf8de847b054f2f184f56cc640df7803f5f9e 100644 (file)
@@ -280,6 +280,7 @@ TESTS = \
        objects/interface-generics.vala \
        objects/methods.vala \
        objects/paramspec.vala \
+       objects/plugin-module-init.vala \
        objects/properties.vala \
        objects/property-notify.vala \
        objects/property-read-only-auto.vala \
diff --git a/tests/objects/plugin-module-init.vala b/tests/objects/plugin-module-init.vala
new file mode 100644 (file)
index 0000000..9599911
--- /dev/null
@@ -0,0 +1,14 @@
+public class Module : GLib.TypeModule {
+       int private_field = 42;
+}
+
+[ModuleInit]
+public GLib.Type init_plugin (TypeModule? m) {
+       return typeof (Module);
+}
+
+void main () {
+       var o = GLib.Object.new (init_plugin (null));
+       assert (o is TypeModule);
+       assert (o is Module);
+}