]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "use_string_marshalling = true" dbus-test
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 6 Mar 2017 12:16:45 +0000 (13:16 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 6 Mar 2017 13:16:14 +0000 (14:16 +0100)
Commit 09e6818d01e introduced the possibility of inserting _error
labels at the end of functions, which make C compilers angry.
This "test" (no actual tests are run, just compile correctness is
checked here) triggers some of these situations.

the "test3" abstract method is trickier though, it doesn't warn
but produces code with early returns, which in practice means
possible leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=778540

tests/Makefile.am
tests/dbus/enum-string-marshalling.vala [new file with mode: 0644]

index 67baf08bd971420f577cfe75690ffff17965cb97..cd9f5695a458f326ed8d2aaa5217e4019195bc1d 100644 (file)
@@ -258,6 +258,7 @@ TESTS = \
        dbus/errors.test \
        dbus/async.test \
        dbus/async-errors.test \
+       dbus/enum-string-marshalling.vala \
        dbus/signals.test \
        dbus/filedescriptor.test \
        dbus/filedescriptor-errors.test \
diff --git a/tests/dbus/enum-string-marshalling.vala b/tests/dbus/enum-string-marshalling.vala
new file mode 100644 (file)
index 0000000..14942a3
--- /dev/null
@@ -0,0 +1,16 @@
+[DBus (use_string_marshalling = true)]
+public enum FooEnum {
+       BAR
+}
+
+[DBus (name = "org.example.Test")]
+public interface Test : GLib.Object {
+       public abstract async void test1 (FooEnum e) throws DBusError;
+       public abstract void test2 (FooEnum e) throws DBusError;
+       public abstract void test3 (FooEnum e1, UnixOutputStream output_stream, FooEnum e2) throws DBusError;
+       //FIXME public abstract void test4 (FooEnum e);
+}
+
+void main () {
+       // We just want to ensure compile correctness here
+}