[vala/staging] tests: Add "return in construct/destructor" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Add "return in construct/destructor" tests to increase coverage
- Date: Fri, 7 Aug 2020 17:07:12 +0000 (UTC)
commit 01914cd1303b34bb583044f49370e7d21a6d44e8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Aug 6 22:03:43 2020 +0200
tests: Add "return in construct/destructor" tests to increase coverage
tests/objects/constructors.vala | 13 +++++++++++++
tests/objects/destructors.vala | 13 +++++++++++++
2 files changed, 26 insertions(+)
---
diff --git a/tests/objects/constructors.vala b/tests/objects/constructors.vala
index e5f7c92a0..ad6d4065c 100644
--- a/tests/objects/constructors.vala
+++ b/tests/objects/constructors.vala
@@ -20,6 +20,16 @@ class Bar : Foo {
}
}
+class Manam : Bar {
+ construct {
+ bool b = true;
+ if (b) {
+ return;
+ }
+ assert_not_reached ();
+ }
+}
+
void main () {
Bar bar;
@@ -28,4 +38,7 @@ void main () {
bar = new Bar.pro ();
assert (bar.foo == "foo.protected");
+
+ var manam = new Manam ();
+ assert (manam.foo == "foo.private");
}
diff --git a/tests/objects/destructors.vala b/tests/objects/destructors.vala
index c25702eb4..7a99f83fd 100644
--- a/tests/objects/destructors.vala
+++ b/tests/objects/destructors.vala
@@ -26,9 +26,22 @@ class Bar : Object {
}
}
+class Manam : Object {
+ ~Manam () {
+ bool b = true;
+ if (b) {
+ return;
+ }
+ assert_not_reached ();
+ }
+}
+
void main () {
typeof (Foo);
var bar = new Bar ();
bar = null;
+
+ var manam = new Manam ();
+ manam = null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]