[vala/staging] tests: Add some invalid "array slice" tests to increase coverage



commit 4b0034440fc9b80b2b86cac2289e447f6fc22716
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Mar 20 08:27:47 2019 +0100

    tests: Add some invalid "array slice" tests to increase coverage

 tests/Makefile.am                     | 3 +++
 tests/arrays/slice-invalid-start.test | 7 +++++++
 tests/arrays/slice-invalid-stop.test  | 7 +++++++
 tests/arrays/slice-no-array.test      | 7 +++++++
 4 files changed, 24 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 154f06eaa..e6ec53941 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -71,6 +71,9 @@ TESTS = \
        arrays/field-global-length-cname.vala \
        arrays/struct-field-length-cname.vala \
        arrays/incompatible-integer-elements.test \
+       arrays/slice-invalid-start.test \
+       arrays/slice-invalid-stop.test \
+       arrays/slice-no-array.test \
        chainup/base-class-invalid.test \
        chainup/base-enum-invalid.test \
        chainup/base-invalid.test \
diff --git a/tests/arrays/slice-invalid-start.test b/tests/arrays/slice-invalid-start.test
new file mode 100644
index 000000000..20f4ed6f6
--- /dev/null
+++ b/tests/arrays/slice-invalid-start.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+const string[] array = { "foo", "bar", "manam" };
+
+void main () {
+       unowned string[] slice = array[0.0:3];
+}
diff --git a/tests/arrays/slice-invalid-stop.test b/tests/arrays/slice-invalid-stop.test
new file mode 100644
index 000000000..a8b18a283
--- /dev/null
+++ b/tests/arrays/slice-invalid-stop.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+const string[] array = { "foo", "bar", "manam" };
+
+void main () {
+       unowned string[] slice = array[0:3.0];
+}
diff --git a/tests/arrays/slice-no-array.test b/tests/arrays/slice-no-array.test
new file mode 100644
index 000000000..cb7179860
--- /dev/null
+++ b/tests/arrays/slice-no-array.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+const int foo = 42;
+
+void main () {
+       int bar = foo[0:3];
+}


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