[vala/wip/code-transformer: 27/27] tests: Add "postcondition with local result" test to increase coverage



commit d5adda2f716d20efc3e83e368f3837e2ef6db300
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Apr 14 18:03:50 2019 +0200

    tests: Add "postcondition with local result" test to increase coverage

 tests/Makefile.am                             | 1 +
 tests/methods/postcondition-local-result.vala | 8 ++++++++
 2 files changed, 9 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0386292af..3fb9798e3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 000000000..f5b5f62f9
--- /dev/null
+++ b/tests/methods/postcondition-local-result.vala
@@ -0,0 +1,8 @@
+public string foo () ensures (result.length >= 3) {
+       string result = "bar";
+       return result;
+}
+
+void main () {
+       assert (foo () == "bar");
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]