]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add invalid "type-argument" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 13 Jun 2018 15:16:38 +0000 (17:16 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 13 Jun 2018 15:21:51 +0000 (17:21 +0200)
tests/Makefile.am
tests/semantic/class-too-few-type-arguments.test [new file with mode: 0644]
tests/semantic/class-too-many-type-arguments.test [new file with mode: 0644]
tests/semantic/delegate-too-few-type-arguments.test [new file with mode: 0644]
tests/semantic/delegate-too-many-type-arguments.test [new file with mode: 0644]
tests/semantic/method-too-few-type-arguments.test [new file with mode: 0644]
tests/semantic/method-too-many-type-arguments.test [new file with mode: 0644]

index c05a68d51ecfe93021ef1cde228ff2c8aa521bef..0ebea06584f7436449c96cc3c35e7f783d184ff6 100644 (file)
@@ -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 (file)
index 0000000..7ff295f
--- /dev/null
@@ -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 (file)
index 0000000..55674b3
--- /dev/null
@@ -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 (file)
index 0000000..a232a86
--- /dev/null
@@ -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 (file)
index 0000000..153e055
--- /dev/null
@@ -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 (file)
index 0000000..9549990
--- /dev/null
@@ -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 (file)
index 0000000..e43cfa3
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+void bar (string s, int i) {
+}
+
+void main () {
+       bar<string> ("foo", 42);
+}