[vala/0.36] tests: Add invalid "control-flow" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] tests: Add invalid "control-flow" tests to increase coverage
- Date: Sun, 28 Oct 2018 11:47:23 +0000 (UTC)
commit 928480cc99d7d2995bb9c09a3b18c8009ef92b11
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Feb 5 11:08:25 2018 +0100
tests: Add invalid "control-flow" tests to increase coverage
tests/Makefile.am | 8 ++++++++
tests/control-flow/break-invalid.test | 5 +++++
tests/control-flow/continue-invalid.test | 5 +++++
tests/control-flow/double-catch.test | 12 ++++++++++++
tests/control-flow/finally-return.test | 8 ++++++++
tests/control-flow/missing-break.test | 8 ++++++++
tests/control-flow/missing-return.test | 7 +++++++
tests/control-flow/unassigned-local-block-variable.test | 6 ++++++
tests/control-flow/unassigned-local-variable.test | 11 +++++++++++
9 files changed, 70 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 586556aba..264fd8b15 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -118,12 +118,20 @@ TESTS = \
methods/printf-constructor.vala \
methods/printf-constructor-invalid.test \
control-flow/break.vala \
+ control-flow/break-invalid.test \
+ control-flow/continue-invalid.test \
+ control-flow/double-catch.test \
control-flow/expressions-conditional.vala \
+ control-flow/finally-return.test \
control-flow/for.vala \
control-flow/foreach.vala \
+ control-flow/missing-break.test \
+ control-flow/missing-return.test \
control-flow/nested-conditional.vala \
control-flow/switch.vala \
control-flow/sideeffects.vala \
+ control-flow/unassigned-local-block-variable.test \
+ control-flow/unassigned-local-variable.test \
control-flow/while-false.vala \
control-flow/bug628336.vala \
control-flow/bug639482.vala \
diff --git a/tests/control-flow/break-invalid.test b/tests/control-flow/break-invalid.test
new file mode 100644
index 000000000..4daa2736e
--- /dev/null
+++ b/tests/control-flow/break-invalid.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ break;
+}
diff --git a/tests/control-flow/continue-invalid.test b/tests/control-flow/continue-invalid.test
new file mode 100644
index 000000000..98c3b9b40
--- /dev/null
+++ b/tests/control-flow/continue-invalid.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ continue;
+}
diff --git a/tests/control-flow/double-catch.test b/tests/control-flow/double-catch.test
new file mode 100644
index 000000000..37013524f
--- /dev/null
+++ b/tests/control-flow/double-catch.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+errordomain FooError {
+ BAR
+}
+
+void main () {
+ try {
+ } catch (FooError err) {
+ } catch (FooError err) {
+ }
+}
diff --git a/tests/control-flow/finally-return.test b/tests/control-flow/finally-return.test
new file mode 100644
index 000000000..80c34c161
--- /dev/null
+++ b/tests/control-flow/finally-return.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+ try {
+ } finally {
+ return;
+ }
+}
diff --git a/tests/control-flow/missing-break.test b/tests/control-flow/missing-break.test
new file mode 100644
index 000000000..94c7e08d0
--- /dev/null
+++ b/tests/control-flow/missing-break.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+ int foo = 0;
+ switch (foo) {
+ case 0:
+ }
+}
diff --git a/tests/control-flow/missing-return.test b/tests/control-flow/missing-return.test
new file mode 100644
index 000000000..84e8bbf64
--- /dev/null
+++ b/tests/control-flow/missing-return.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+string get_foo () {
+}
+
+void main () {
+}
diff --git a/tests/control-flow/unassigned-local-block-variable.test
b/tests/control-flow/unassigned-local-block-variable.test
new file mode 100644
index 000000000..11913583b
--- /dev/null
+++ b/tests/control-flow/unassigned-local-block-variable.test
@@ -0,0 +1,6 @@
+Invalid Code
+
+void main () {
+ string s;
+ print ("%s", s);
+}
diff --git a/tests/control-flow/unassigned-local-variable.test
b/tests/control-flow/unassigned-local-variable.test
new file mode 100644
index 000000000..279b4d929
--- /dev/null
+++ b/tests/control-flow/unassigned-local-variable.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+void main () {
+ bool cond = false;
+
+ string s;
+ if (cond) {
+ s = "foo";
+ }
+ print ("%s", s);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]