[vala/0.40] tests: Add invalid "switch" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] tests: Add invalid "switch" tests to increase coverage
- Date: Thu, 6 Dec 2018 13:13:05 +0000 (UTC)
commit f10d3db8083b0f5710098de3cc4444d418ab501a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Nov 27 10:50:12 2018 +0100
tests: Add invalid "switch" tests to increase coverage
tests/Makefile.am | 4 ++++
tests/semantic/switch-duplicate-label.test | 11 +++++++++++
tests/semantic/switch-label-not-compatible.test | 10 ++++++++++
tests/semantic/switch-label-not-constant.test | 10 ++++++++++
tests/semantic/switch-type-unsupported.test | 11 +++++++++++
5 files changed, 46 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 97eb91572..6c06fcbef 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -612,6 +612,10 @@ TESTS = \
semantic/struct-field-initializer.test \
semantic/struct-invalid-base.test \
semantic/struct-recursive.test \
+ semantic/switch-duplicate-label.test \
+ semantic/switch-label-not-compatible.test \
+ semantic/switch-label-not-constant.test \
+ semantic/switch-type-unsupported.test \
semantic/yield-call-requires-async-context.test \
semantic/yield-call-requires-async-method.test \
semantic/yield-creation-requires-async-context.test \
diff --git a/tests/semantic/switch-duplicate-label.test b/tests/semantic/switch-duplicate-label.test
new file mode 100644
index 000000000..d10b9296b
--- /dev/null
+++ b/tests/semantic/switch-duplicate-label.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+void main () {
+ int foo = 23;
+ const int BAR = 42;
+
+ switch (foo) {
+ case BAR: break;
+ case BAR: break;
+ }
+}
diff --git a/tests/semantic/switch-label-not-compatible.test b/tests/semantic/switch-label-not-compatible.test
new file mode 100644
index 000000000..990f06283
--- /dev/null
+++ b/tests/semantic/switch-label-not-compatible.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+void main () {
+ int foo = 23;
+ const int64 BAR = 42;
+
+ switch (foo) {
+ case BAR: break;
+ }
+}
diff --git a/tests/semantic/switch-label-not-constant.test b/tests/semantic/switch-label-not-constant.test
new file mode 100644
index 000000000..73893304c
--- /dev/null
+++ b/tests/semantic/switch-label-not-constant.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+void main () {
+ int foo = 23
+ int bar = 42;
+
+ switch (foo) {
+ case bar: break;
+ }
+}
diff --git a/tests/semantic/switch-type-unsupported.test b/tests/semantic/switch-type-unsupported.test
new file mode 100644
index 000000000..eb8f971d3
--- /dev/null
+++ b/tests/semantic/switch-type-unsupported.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+struct Foo {
+}
+
+void main () {
+ Foo foo = {};
+
+ switch (foo) {
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]