summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2018-02-06 23:45:27 +0000
committerCorentin Noël <corentin@elementary.io>2018-02-06 23:45:27 +0000
commit754271065c4b68e8de5836e232ae6e0482791028 (patch)
treeb648c0cf22567f9595fa57170e9ae5149e786b9b
parent2a04bc398bcca239fa48e2808904d8e25ce1ef3d (diff)
downloadvala-wip/tintou/more-tests.tar.gz
tests: Add invalid "foreach" tests to increase coveragewip/tintou/more-tests
-rw-r--r--tests/Makefile.am14
-rw-r--r--tests/foreach/collection-iterator-args.test18
-rw-r--r--tests/foreach/collection-iterator-void.test14
-rw-r--r--tests/foreach/collection-iterator-wrong-types.test8
-rw-r--r--tests/foreach/collection-missing-iterator.test12
-rw-r--r--tests/foreach/collection-missing-next-value.test18
-rw-r--r--tests/foreach/collection-missing-type.test8
-rw-r--r--tests/foreach/collection-next-args.test20
-rw-r--r--tests/foreach/collection-next-get-args.test24
-rw-r--r--tests/foreach/collection-next-get-void.test24
-rw-r--r--tests/foreach/collection-next-missing-get.test20
-rw-r--r--tests/foreach/collection-next-value-args.test20
-rw-r--r--tests/foreach/collection-next-value-void.test20
-rw-r--r--tests/foreach/collection-next-void.test20
-rw-r--r--tests/foreach/collection-wrong-types.test8
15 files changed, 248 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 13b7e8050..c69d2756a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -164,6 +164,20 @@ TESTS = \
enums/bug673879.vala \
enums/bug763831.vala \
enums/bug780050.vala \
+ foreach/collection-iterator-args.test \
+ foreach/collection-iterator-void.test \
+ foreach/collection-iterator-wrong-types.test \
+ foreach/collection-missing-iterator.test \
+ foreach/collection-missing-next-value.test \
+ foreach/collection-missing-type.test \
+ foreach/collection-next-get-args.test \
+ foreach/collection-next-get-void.test \
+ foreach/collection-next-missing-get.test \
+ foreach/collection-next-value-args.test \
+ foreach/collection-next-args.test \
+ foreach/collection-next-value-void.test \
+ foreach/collection-next-void.test \
+ foreach/collection-wrong-types.test \
structs/struct_only.vala \
structs/structs.vala \
structs/gvalue.vala \
diff --git a/tests/foreach/collection-iterator-args.test b/tests/foreach/collection-iterator-args.test
new file mode 100644
index 000000000..e4844a570
--- /dev/null
+++ b/tests/foreach/collection-iterator-args.test
@@ -0,0 +1,18 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator (int foo) {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+
+}
diff --git a/tests/foreach/collection-iterator-void.test b/tests/foreach/collection-iterator-void.test
new file mode 100644
index 000000000..e4f63edc3
--- /dev/null
+++ b/tests/foreach/collection-iterator-void.test
@@ -0,0 +1,14 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public void iterator () {
+ return;
+ }
+}
diff --git a/tests/foreach/collection-iterator-wrong-types.test b/tests/foreach/collection-iterator-wrong-types.test
new file mode 100644
index 000000000..db4743397
--- /dev/null
+++ b/tests/foreach/collection-iterator-wrong-types.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+ var test = new GLib.List<int> ();
+ foreach (string t in test) {
+
+ }
+}
diff --git a/tests/foreach/collection-missing-iterator.test b/tests/foreach/collection-missing-iterator.test
new file mode 100644
index 000000000..0e51aca62
--- /dev/null
+++ b/tests/foreach/collection-missing-iterator.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+
+}
diff --git a/tests/foreach/collection-missing-next-value.test b/tests/foreach/collection-missing-next-value.test
new file mode 100644
index 000000000..55913d295
--- /dev/null
+++ b/tests/foreach/collection-missing-next-value.test
@@ -0,0 +1,18 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+
+}
diff --git a/tests/foreach/collection-missing-type.test b/tests/foreach/collection-missing-type.test
new file mode 100644
index 000000000..d9e84c6b7
--- /dev/null
+++ b/tests/foreach/collection-missing-type.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+ GLib.List test;
+ foreach (var t in test) {
+
+ }
+}
diff --git a/tests/foreach/collection-next-args.test b/tests/foreach/collection-next-args.test
new file mode 100644
index 000000000..bbd77d413
--- /dev/null
+++ b/tests/foreach/collection-next-args.test
@@ -0,0 +1,20 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public bool next (string test) {
+ return true;
+ }
+}
diff --git a/tests/foreach/collection-next-get-args.test b/tests/foreach/collection-next-get-args.test
new file mode 100644
index 000000000..effcfa598
--- /dev/null
+++ b/tests/foreach/collection-next-get-args.test
@@ -0,0 +1,24 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public bool next () {
+ return true;
+ }
+
+ public G get (int arg) {
+ return (G)null;
+ }
+}
diff --git a/tests/foreach/collection-next-get-void.test b/tests/foreach/collection-next-get-void.test
new file mode 100644
index 000000000..7847f15f0
--- /dev/null
+++ b/tests/foreach/collection-next-get-void.test
@@ -0,0 +1,24 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public bool next () {
+ return true;
+ }
+
+ public void get () {
+ return;
+ }
+}
diff --git a/tests/foreach/collection-next-missing-get.test b/tests/foreach/collection-next-missing-get.test
new file mode 100644
index 000000000..26b41ecd2
--- /dev/null
+++ b/tests/foreach/collection-next-missing-get.test
@@ -0,0 +1,20 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public bool next () {
+ return true;
+ }
+}
diff --git a/tests/foreach/collection-next-value-args.test b/tests/foreach/collection-next-value-args.test
new file mode 100644
index 000000000..d400d8fe2
--- /dev/null
+++ b/tests/foreach/collection-next-value-args.test
@@ -0,0 +1,20 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public bool next_value (string test) {
+ return true;
+ }
+}
diff --git a/tests/foreach/collection-next-value-void.test b/tests/foreach/collection-next-value-void.test
new file mode 100644
index 000000000..e8cf5404f
--- /dev/null
+++ b/tests/foreach/collection-next-value-void.test
@@ -0,0 +1,20 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public void next_value () {
+ return;
+ }
+}
diff --git a/tests/foreach/collection-next-void.test b/tests/foreach/collection-next-void.test
new file mode 100644
index 000000000..b44aa2a6b
--- /dev/null
+++ b/tests/foreach/collection-next-void.test
@@ -0,0 +1,20 @@
+Invalid Code
+
+void main () {
+ Test test;
+ foreach (var t in test) {
+
+ }
+}
+
+public class Test<G> {
+ public Iterator<G> iterator () {
+ return new Iterator<G> ();
+ }
+}
+
+public class Iterator<G> {
+ public void next () {
+ return;
+ }
+}
diff --git a/tests/foreach/collection-wrong-types.test b/tests/foreach/collection-wrong-types.test
new file mode 100644
index 000000000..74c78d910
--- /dev/null
+++ b/tests/foreach/collection-wrong-types.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void main () {
+ string[] test = {"foo", "bar"};
+ foreach (int t in test) {
+
+ }
+}