[vala/wip/tintou/more-tests: 2/2] tests: Add invalid "foreach" tests to increase coverage
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/tintou/more-tests: 2/2] tests: Add invalid "foreach" tests to increase coverage
- Date: Tue, 6 Feb 2018 23:58:19 +0000 (UTC)
commit 754271065c4b68e8de5836e232ae6e0482791028
Author: Corentin Noël <corentin elementary io>
Date: Tue Feb 6 23:45:27 2018 +0000
tests: Add invalid "foreach" tests to increase coverage
tests/Makefile.am | 14 +++++++++++
tests/foreach/collection-iterator-args.test | 18 +++++++++++++++
tests/foreach/collection-iterator-void.test | 14 +++++++++++
tests/foreach/collection-iterator-wrong-types.test | 8 ++++++
tests/foreach/collection-missing-iterator.test | 12 ++++++++++
tests/foreach/collection-missing-next-value.test | 18 +++++++++++++++
tests/foreach/collection-missing-type.test | 8 ++++++
tests/foreach/collection-next-args.test | 20 ++++++++++++++++
tests/foreach/collection-next-get-args.test | 24 ++++++++++++++++++++
tests/foreach/collection-next-get-void.test | 24 ++++++++++++++++++++
tests/foreach/collection-next-missing-get.test | 20 ++++++++++++++++
tests/foreach/collection-next-value-args.test | 20 ++++++++++++++++
tests/foreach/collection-next-value-void.test | 20 ++++++++++++++++
tests/foreach/collection-next-void.test | 20 ++++++++++++++++
tests/foreach/collection-wrong-types.test | 8 ++++++
15 files changed, 248 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 13b7e80..c69d275 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 0000000..e4844a5
--- /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 0000000..e4f63ed
--- /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 0000000..db47433
--- /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 0000000..0e51aca
--- /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 0000000..55913d2
--- /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 0000000..d9e84c6
--- /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 0000000..bbd77d4
--- /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 0000000..effcfa5
--- /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 0000000..7847f15
--- /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 0000000..26b41ec
--- /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 0000000..d400d8f
--- /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 0000000..e8cf540
--- /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 0000000..b44aa2a
--- /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 0000000..74c78d9
--- /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) {
+
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]