]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add testcase for missed postconditions in methods returning void
authorLuca Bruno <lucabru@src.gnome.org>
Tue, 11 Jun 2013 20:59:14 +0000 (22:59 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Tue, 11 Jun 2013 20:59:14 +0000 (22:59 +0200)
tests/Makefile.am
tests/methods/prepostconditions.vala [new file with mode: 0644]

index 8392c677a8d4324e375378119467bebafb29f67c..06ca778d4b91b9bcaf1ac47911138b872f349a04 100644 (file)
@@ -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 (file)
index 0000000..871bfa7
--- /dev/null
@@ -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