[vala] Add testcase for missed postconditions in methods returning void
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Add testcase for missed postconditions in methods returning void
- Date: Tue, 11 Jun 2013 21:07:44 +0000 (UTC)
commit a3c2589cf39f9dd6efcb403e47c68e1b0fba76d5
Author: Luca Bruno <lucabru src gnome org>
Date: Tue Jun 11 22:59:14 2013 +0200
Add testcase for missed postconditions in methods returning void
tests/Makefile.am | 1 +
tests/methods/prepostconditions.vala | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8392c67..06ca778 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,6 +36,7 @@ TESTS = \
namespaces.vala \
methods/lambda.vala \
methods/closures.vala \
+ methods/prepostconditions.vala \
methods/symbolresolution.vala \
methods/bug595538.vala \
methods/bug596726.vala \
diff --git a/tests/methods/prepostconditions.vala b/tests/methods/prepostconditions.vala
new file mode 100644
index 0000000..871bfa7
--- /dev/null
+++ b/tests/methods/prepostconditions.vala
@@ -0,0 +1,12 @@
+class Foo {
+ public bool ensured = false;
+
+ public void foo () ensures (ensured = true) {
+ }
+}
+
+void main () {
+ var foo = new Foo();
+ foo.foo();
+ assert(foo.ensured);
+}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]