]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add invalid "return" tests to increase coverage a6552034120c860aff0299d4774365ae74ccaa29
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 08:33:19 +0000 (09:33 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Feb 2020 08:44:50 +0000 (09:44 +0100)
tests/Makefile.am
tests/semantic/return-in-nonvoid.test [new file with mode: 0644]
tests/semantic/return-in-void.test [new file with mode: 0644]
tests/semantic/return-missing-ownership.test [new file with mode: 0644]
tests/semantic/return-missing-transfer.test [new file with mode: 0644]

index c10c72b41f0ea916383790c32e7f81e52189f3ca..d4e3653537af19691666eac91e838c47af7f4b81 100644 (file)
@@ -854,6 +854,10 @@ TESTS = \
        semantic/property-void.test \
        semantic/reference-transfer-not-supported.test \
        semantic/reference-transfer-unavailable.test \
+       semantic/return-in-nonvoid.test \
+       semantic/return-in-void.test \
+       semantic/return-missing-ownership.test \
+       semantic/return-missing-transfer.test \
        semantic/signal-clash-inherited.test \
        semantic/signal-compact-class.test \
        semantic/signal-detail-invalid.test \
diff --git a/tests/semantic/return-in-nonvoid.test b/tests/semantic/return-in-nonvoid.test
new file mode 100644 (file)
index 0000000..95d11f6
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+int foo () {
+       return;
+}
+
+void main () {
+}
diff --git a/tests/semantic/return-in-void.test b/tests/semantic/return-in-void.test
new file mode 100644 (file)
index 0000000..03f8ec6
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo () {
+       return 23;
+}
+
+void main () {
+}
diff --git a/tests/semantic/return-missing-ownership.test b/tests/semantic/return-missing-ownership.test
new file mode 100644 (file)
index 0000000..233c343
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+unowned string foo () {
+       var s = "foo";
+       return s;
+}
+
+void main () {
+}
diff --git a/tests/semantic/return-missing-transfer.test b/tests/semantic/return-missing-transfer.test
new file mode 100644 (file)
index 0000000..6112120
--- /dev/null
@@ -0,0 +1,12 @@
+Invalid Code
+
+string bar () {
+       return "bar";
+}
+
+unowned string foo () {
+       return bar ();
+}
+
+void main () {
+}