]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "postcondition with local result" test to increase coverage wip/code-transformer
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 14 Apr 2019 16:03:50 +0000 (18:03 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Fri, 19 Apr 2019 13:29:54 +0000 (15:29 +0200)
tests/Makefile.am
tests/methods/postcondition-local-result.vala [new file with mode: 0644]

index 0386292af934c4f56330e76da349ea603c3d4fb3..3fb9798e3d103b62755c0c5e94a406eba68db17b 100644 (file)
@@ -99,6 +99,7 @@ TESTS = \
        methods/closures.vala \
        methods/contains.vala \
        methods/iterator.vala \
+       methods/postcondition-local-result.vala \
        methods/prepostconditions.vala \
        methods/same-name.vala \
        methods/symbolresolution.vala \
diff --git a/tests/methods/postcondition-local-result.vala b/tests/methods/postcondition-local-result.vala
new file mode 100644 (file)
index 0000000..f5b5f62
--- /dev/null
@@ -0,0 +1,8 @@
+public string foo () ensures (result.length >= 3) {
+       string result = "bar";
+       return result;
+}
+
+void main () {
+       assert (foo () == "bar");
+}