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



commit 7aa91f0350fe16254bde7f4a8038478cb2441244
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 4995cdf3a..6a25dc6ed 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,6 +68,9 @@ TESTS = \
        arrays/class-field-length-cname.vala \
        arrays/field-global-length-cname.vala \
        arrays/struct-field-length-cname.vala \
+       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]