]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add invalid variable declaration tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 21 Sep 2018 20:53:18 +0000 (22:53 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 22 Sep 2018 08:44:30 +0000 (10:44 +0200)
tests/Makefile.am
tests/semantic/initializer-unknown-type.test [new file with mode: 0644]
tests/semantic/localvariable-owned-to-unowned.test [new file with mode: 0644]
tests/semantic/localvariable-var-static-access-instance-field.test [new file with mode: 0644]
tests/semantic/localvariable-var-static-access-instance-method.test [new file with mode: 0644]
tests/semantic/localvariable-var-without-initializer.test [new file with mode: 0644]
tests/semantic/localvariable-void.test [new file with mode: 0644]

index 1057f72a3d691d1972165e66d0e078aba78a3733..eda642ae2a52d9d1fa6472b76df86b3b9368820c 100644 (file)
@@ -542,6 +542,12 @@ TESTS = \
        semantic/foreach-next-value-void.test \
        semantic/foreach-next-void.test \
        semantic/foreach-wrong-types.test \
+       semantic/initializer-unknown-type.test \
+       semantic/localvariable-owned-to-unowned.test \
+       semantic/localvariable-var-static-access-instance-field.test \
+       semantic/localvariable-var-static-access-instance-method.test \
+       semantic/localvariable-var-without-initializer.test \
+       semantic/localvariable-void.test \
        semantic/method-abstract.test \
        semantic/method-abstract-body.test \
        semantic/method-async-ref-parameter.test \
diff --git a/tests/semantic/initializer-unknown-type.test b/tests/semantic/initializer-unknown-type.test
new file mode 100644 (file)
index 0000000..1ab04ad
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       var foo = { "foo" };
+}
diff --git a/tests/semantic/localvariable-owned-to-unowned.test b/tests/semantic/localvariable-owned-to-unowned.test
new file mode 100644 (file)
index 0000000..661b6b9
--- /dev/null
@@ -0,0 +1,9 @@
+Invalid Code
+
+string get_foo () {
+       return "foo";
+}
+
+void main () {
+       unowned string foo = get_foo ();
+}
diff --git a/tests/semantic/localvariable-var-static-access-instance-field.test b/tests/semantic/localvariable-var-static-access-instance-field.test
new file mode 100644 (file)
index 0000000..a2d5b41
--- /dev/null
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo {
+       int field;
+
+       static void bar () {
+               var f = field;
+       }
+}
+
+void main () {
+}
diff --git a/tests/semantic/localvariable-var-static-access-instance-method.test b/tests/semantic/localvariable-var-static-access-instance-method.test
new file mode 100644 (file)
index 0000000..738ffb1
--- /dev/null
@@ -0,0 +1,14 @@
+Invalid Code
+
+class Foo {
+       void method () {
+       }
+
+       static void bar () {
+               var m = method;
+       }
+}
+
+void main () {
+}
+
diff --git a/tests/semantic/localvariable-var-without-initializer.test b/tests/semantic/localvariable-var-without-initializer.test
new file mode 100644 (file)
index 0000000..c3bb93c
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       var foo;
+}
diff --git a/tests/semantic/localvariable-void.test b/tests/semantic/localvariable-void.test
new file mode 100644 (file)
index 0000000..b9ef495
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       void foo;
+}