[vala/staging] tests: Add invalid "type-argument" tests to increase coverage



commit 01cd665d35ee81b906c45f65fafd127c012a2d5a
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Jun 13 17:16:38 2018 +0200

    tests: Add invalid "type-argument" tests to increase coverage

 tests/Makefile.am                                    | 6 ++++++
 tests/semantic/class-too-few-type-arguments.test     | 8 ++++++++
 tests/semantic/class-too-many-type-arguments.test    | 8 ++++++++
 tests/semantic/delegate-too-few-type-arguments.test  | 7 +++++++
 tests/semantic/delegate-too-many-type-arguments.test | 7 +++++++
 tests/semantic/method-too-few-type-arguments.test    | 8 ++++++++
 tests/semantic/method-too-many-type-arguments.test   | 8 ++++++++
 7 files changed, 52 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c05a68d51..0ebea0658 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -461,11 +461,15 @@ TESTS = \
        parser/yield-method.test \
        parser/bug728574.vala \
        parser/bug749576.vala \
+       semantic/class-too-few-type-arguments.test \
+       semantic/class-too-many-type-arguments.test \
        semantic/constant-extern.test \
        semantic/constant-value.test \
        semantic/constant-value-missing.test \
        semantic/constant-value-type.test \
        semantic/constant-void.test \
+       semantic/delegate-too-few-type-arguments.test \
+       semantic/delegate-too-many-type-arguments.test \
        semantic/field-accessibility.test \
        semantic/field-compact-static.test \
        semantic/field-external.test \
@@ -510,6 +514,8 @@ TESTS = \
        semantic/method-private-virtual.test \
        semantic/method-protected.test \
        semantic/method-return-accessibility.test \
+       semantic/method-too-few-type-arguments.test \
+       semantic/method-too-many-type-arguments.test \
        semantic/method-virtual.test \
        semantic/method-virtual-body.test \
        semantic/parameter-accessibility.test \
diff --git a/tests/semantic/class-too-few-type-arguments.test 
b/tests/semantic/class-too-few-type-arguments.test
new file mode 100644
index 000000000..7ff295f4e
--- /dev/null
+++ b/tests/semantic/class-too-few-type-arguments.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+class Foo<G,T> {
+}
+
+void main () {
+       var foo = new Foo<string> ();
+}
diff --git a/tests/semantic/class-too-many-type-arguments.test 
b/tests/semantic/class-too-many-type-arguments.test
new file mode 100644
index 000000000..55674b32d
--- /dev/null
+++ b/tests/semantic/class-too-many-type-arguments.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+class Foo {
+}
+
+void main () {
+       var foo = new Foo<string> ();
+}
diff --git a/tests/semantic/delegate-too-few-type-arguments.test 
b/tests/semantic/delegate-too-few-type-arguments.test
new file mode 100644
index 000000000..a232a86c5
--- /dev/null
+++ b/tests/semantic/delegate-too-few-type-arguments.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+delegate void FooFunc<G,T> (G g, T t);
+
+void main () {
+       FooFunc<string> foo = (g, t) => {};
+}
diff --git a/tests/semantic/delegate-too-many-type-arguments.test 
b/tests/semantic/delegate-too-many-type-arguments.test
new file mode 100644
index 000000000..153e0551e
--- /dev/null
+++ b/tests/semantic/delegate-too-many-type-arguments.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+delegate void FooFunc ();
+
+void main () {
+       FooFunc<string> foo = () => {};
+}
diff --git a/tests/semantic/method-too-few-type-arguments.test 
b/tests/semantic/method-too-few-type-arguments.test
new file mode 100644
index 000000000..95499900d
--- /dev/null
+++ b/tests/semantic/method-too-few-type-arguments.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void bar<G,T> (G g, T t) {
+}
+
+void main () {
+       bar<string> ("foo", 42);
+}
diff --git a/tests/semantic/method-too-many-type-arguments.test 
b/tests/semantic/method-too-many-type-arguments.test
new file mode 100644
index 000000000..e43cfa31d
--- /dev/null
+++ b/tests/semantic/method-too-many-type-arguments.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void bar (string s, int i) {
+}
+
+void main () {
+       bar<string> ("foo", 42);
+}


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