[vala/staging] tests: Add invalid variable declaration tests to increase coverage



commit 088d325183dc20bf8a008a203166d0d438f091f3
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Sep 21 22:53:18 2018 +0200

    tests: Add invalid variable declaration tests to increase coverage

 tests/Makefile.am                                          |  6 ++++++
 tests/semantic/initializer-unknown-type.test               |  5 +++++
 tests/semantic/localvariable-owned-to-unowned.test         |  9 +++++++++
 .../localvariable-var-static-access-instance-field.test    | 12 ++++++++++++
 .../localvariable-var-static-access-instance-method.test   | 14 ++++++++++++++
 tests/semantic/localvariable-var-without-initializer.test  |  5 +++++
 tests/semantic/localvariable-void.test                     |  5 +++++
 7 files changed, 56 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1057f72a3..eda642ae2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 000000000..1ab04ad1f
--- /dev/null
+++ b/tests/semantic/initializer-unknown-type.test
@@ -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
index 000000000..661b6b9ca
--- /dev/null
+++ b/tests/semantic/localvariable-owned-to-unowned.test
@@ -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
index 000000000..a2d5b4158
--- /dev/null
+++ b/tests/semantic/localvariable-var-static-access-instance-field.test
@@ -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
index 000000000..738ffb1f9
--- /dev/null
+++ b/tests/semantic/localvariable-var-static-access-instance-method.test
@@ -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
index 000000000..c3bb93cf4
--- /dev/null
+++ b/tests/semantic/localvariable-var-without-initializer.test
@@ -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
index 000000000..b9ef4950e
--- /dev/null
+++ b/tests/semantic/localvariable-void.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       void foo;
+}


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