]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add asynchronous "catch-error-scope" regression test 1dd63caaa083c8d2f298a763d515badf8f34524c
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 21 Jan 2019 15:13:45 +0000 (16:13 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 21 Jan 2019 15:22:49 +0000 (16:22 +0100)
See https://gitlab.gnome.org/GNOME/vala/issues/741

tests/Makefile.am
tests/asynchronous/catch-error-scope.vala [new file with mode: 0644]

index 554c235f7e8b609cf04ec4646f962e8136760fa2..c1f971b8749ab4e2286c10cdffeefda62efae14d 100644 (file)
@@ -412,6 +412,7 @@ TESTS = \
        asynchronous/bug792660.vala \
        asynchronous/bug792942.vala \
        asynchronous/bug793158.vala \
+       asynchronous/catch-error-scope.vala \
        asynchronous/closures.vala \
        asynchronous/generator.vala \
        asynchronous/out-parameter-invalid.test \
diff --git a/tests/asynchronous/catch-error-scope.vala b/tests/asynchronous/catch-error-scope.vala
new file mode 100644 (file)
index 0000000..b479e86
--- /dev/null
@@ -0,0 +1,27 @@
+errordomain FooError {
+       FAIL
+}
+
+async void foo () {
+       try {
+               throw new FooError.FAIL ("Foo");
+       } catch (GLib.Error e) {
+               assert (e is FooError);
+               assert (e.message == "Foo");
+       }
+       try {
+               throw new FooError.FAIL ("Bar");
+       } catch (GLib.Error e) {
+               assert (e is FooError);
+               assert (e.message == "Bar");
+       }
+}
+
+void main () {
+       var loop = new MainLoop ();
+       foo.begin ((o, res) => {
+               foo.end (res);
+               loop.quit ();
+       });
+       loop.run ();
+}