summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2021-04-24 09:11:27 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2021-04-24 09:14:58 +0200
commitbace2691fe52c8cbb93172b0f5c0199bdd124a66 (patch)
treef6f70b076b8bca30729a7f73916ec4a329410577 /tests
parentf6be4cbd7f901683a1e6f4f4a0070b1e87dcce65 (diff)
downloadvala-bace2691fe52c8cbb93172b0f5c0199bdd124a66.tar.gz
vala: Report a warning for unhandled errors in destructors
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1176
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/errors/unhandled.vala45
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f409da1af..684546e44 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -613,6 +613,7 @@ TESTS = \
errors/invalid-type-check.test \
errors/loops.vala \
errors/method-throws.vala \
+ errors/unhandled.vala \
errors/bug567181.vala \
errors/bug579101.vala \
errors/bug596228.vala \
diff --git a/tests/errors/unhandled.vala b/tests/errors/unhandled.vala
new file mode 100644
index 000000000..1a3768a6c
--- /dev/null
+++ b/tests/errors/unhandled.vala
@@ -0,0 +1,45 @@
+public errordomain FooError {
+ FAIL
+}
+
+public class Foo : Object {
+ public string bar {
+ get {
+ throw new FooError.FAIL ("property getter");
+ }
+ set {
+ throw new FooError.FAIL ("property setter");
+ }
+ }
+
+ public Foo () {
+ throw new FooError.FAIL ("creation method");
+ }
+
+ construct {
+ throw new FooError.FAIL ("constructor");
+ }
+
+ class construct {
+ throw new FooError.FAIL ("class constructor");
+ }
+
+ static construct {
+ throw new FooError.FAIL ("static constructor");
+ }
+
+ ~Foo () {
+ throw new FooError.FAIL ("destructor");
+ }
+
+ class ~Foo () {
+ throw new FooError.FAIL ("class destructor");
+ }
+
+ public void foo () {
+ throw new FooError.FAIL ("method");
+ }
+}
+
+void main () {
+}