diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-02-05 18:14:21 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-02-05 18:14:21 +0100 |
commit | 9564db29b14a314ab1f377ac601407fe64048a52 (patch) | |
tree | b1e373ba0ec8c7378792cc86c0a5f027af37f9ac /tests | |
parent | b03d7515ac261c85f5f6126cd6500087be0ee5ea (diff) | |
download | vala-9564db29b14a314ab1f377ac601407fe64048a52.tar.gz |
tests: Add "destructors" test to increase coverage
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/objects/destructors.vala | 34 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 936d141f3..358b5867f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -217,6 +217,7 @@ TESTS = \ objects/classes.vala \ objects/constructor-variadic.test \ objects/constructors.vala \ + objects/destructors.vala \ objects/dynamic.vala \ objects/generics.vala \ objects/initially-unowned.vala \ diff --git a/tests/objects/destructors.vala b/tests/objects/destructors.vala new file mode 100644 index 000000000..c25702eb4 --- /dev/null +++ b/tests/objects/destructors.vala @@ -0,0 +1,34 @@ +class Foo : Object { + class string s; + + class construct { + assert (s == null); + s = "foo"; + } + + class ~Foo () { + assert (s == "foo"); + s = null; + } +} + +class Bar : Object { + string s; + + construct { + assert (s == null); + s = "bar"; + } + + ~Bar () { + assert (s == "bar"); + s = null; + } +} + +void main () { + typeof (Foo); + + var bar = new Bar (); + bar = null; +} |