From: Rico Tzschichholz Date: Fri, 21 Sep 2018 20:53:18 +0000 (+0200) Subject: tests: Add invalid variable declaration tests to increase coverage X-Git-Tag: 0.43.1~214 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=088d325183dc20bf8a008a203166d0d438f091f3;p=thirdparty%2Fvala.git tests: Add invalid variable declaration tests to increase coverage --- 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; +}