[vala/0.36: 169/212] tests: Add "destructors" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36: 169/212] tests: Add "destructors" test to increase coverage
- Date: Sat, 14 Apr 2018 07:57:33 +0000 (UTC)
commit ccc511d1cb5739c54c2dc37bac5faf799322dd1b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Feb 5 18:14:21 2018 +0100
tests: Add "destructors" test to increase coverage
tests/Makefile.am | 1 +
tests/objects/destructors.vala | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45435ba..5f6f816 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -185,6 +185,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 0000000..c25702e
--- /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;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]