From: Rico Tzschichholz Date: Tue, 24 Sep 2019 11:21:44 +0000 (+0200) Subject: tests: Add more "invalid expression" tests to increase coverage X-Git-Tag: 0.44.9~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=257bc7733ffe51e7559d3397e7f44d5665f19271;p=thirdparty%2Fvala.git tests: Add more "invalid expression" tests to increase coverage --- diff --git a/tests/Makefile.am b/tests/Makefile.am index bbe340fb7..4f88ae151 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -720,6 +720,8 @@ TESTS = \ semantic/parameter-params.test \ semantic/parameter-ref-default.test \ semantic/parameter-void.test \ + semantic/pointer-indirection-type-not-supported.test \ + semantic/pointer-indirection-void-not-supported.test \ semantic/property-abstract.test \ semantic/property-abstract-derived-compact.test \ semantic/property-accessibility.test \ @@ -734,6 +736,8 @@ TESTS = \ semantic/property-struct-protected.test \ semantic/property-struct-virtual.test \ semantic/property-void.test \ + semantic/reference-transfer-not-supported.test \ + semantic/reference-transfer-unavailable.test \ semantic/signal-clash-inherited.test \ semantic/signal-compact-class.test \ semantic/signal-detail-invalid.test \ @@ -747,7 +751,12 @@ TESTS = \ semantic/switch-label-not-compatible.test \ semantic/switch-label-not-constant.test \ semantic/switch-type-unsupported.test \ + semantic/throw-no-error-type.test \ semantic/type-argument-ownership-mismatch.test \ + semantic/unary-unsupported-complement.test \ + semantic/unary-unsupported-increment.test \ + semantic/unary-unsupported-minus.test \ + semantic/unary-unsupported-negation.test \ semantic/yield-call-requires-async-context.test \ semantic/yield-call-requires-async-method.test \ semantic/yield-creation-requires-async-context.test \ diff --git a/tests/semantic/pointer-indirection-type-not-supported.test b/tests/semantic/pointer-indirection-type-not-supported.test new file mode 100644 index 000000000..64f7c6c20 --- /dev/null +++ b/tests/semantic/pointer-indirection-type-not-supported.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + string foo = "foo"; + *foo = null; +} diff --git a/tests/semantic/pointer-indirection-void-not-supported.test b/tests/semantic/pointer-indirection-void-not-supported.test new file mode 100644 index 000000000..d10f65f2c --- /dev/null +++ b/tests/semantic/pointer-indirection-void-not-supported.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + void* foo = null; + *foo = null; +} diff --git a/tests/semantic/reference-transfer-not-supported.test b/tests/semantic/reference-transfer-not-supported.test new file mode 100644 index 000000000..4f244454e --- /dev/null +++ b/tests/semantic/reference-transfer-not-supported.test @@ -0,0 +1,9 @@ +Invalid Code + +string foo () { + return "foo"; +} + +void main () { + string s = (owned) foo (); +} diff --git a/tests/semantic/reference-transfer-unavailable.test b/tests/semantic/reference-transfer-unavailable.test new file mode 100644 index 000000000..5a343b89c --- /dev/null +++ b/tests/semantic/reference-transfer-unavailable.test @@ -0,0 +1,7 @@ +Invalid Code + +unowned string foo = "foo"; + +void main () { + string s = (owned) foo; +} diff --git a/tests/semantic/throw-no-error-type.test b/tests/semantic/throw-no-error-type.test new file mode 100644 index 000000000..6b552551c --- /dev/null +++ b/tests/semantic/throw-no-error-type.test @@ -0,0 +1,8 @@ +Invalid Code + +struct Foo { + public Foo foo; +} + +void main () { +} diff --git a/tests/semantic/unary-unsupported-complement.test b/tests/semantic/unary-unsupported-complement.test new file mode 100644 index 000000000..4b02110df --- /dev/null +++ b/tests/semantic/unary-unsupported-complement.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + string foo = "foo"; + var s = ~foo; +} diff --git a/tests/semantic/unary-unsupported-increment.test b/tests/semantic/unary-unsupported-increment.test new file mode 100644 index 000000000..880e3249a --- /dev/null +++ b/tests/semantic/unary-unsupported-increment.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + string foo = "foo"; + var s = ++foo; +} diff --git a/tests/semantic/unary-unsupported-minus.test b/tests/semantic/unary-unsupported-minus.test new file mode 100644 index 000000000..484d41b88 --- /dev/null +++ b/tests/semantic/unary-unsupported-minus.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + string foo = "foo"; + var s = -foo; +} diff --git a/tests/semantic/unary-unsupported-negation.test b/tests/semantic/unary-unsupported-negation.test new file mode 100644 index 000000000..e002765b0 --- /dev/null +++ b/tests/semantic/unary-unsupported-negation.test @@ -0,0 +1,6 @@ +Invalid Code + +void main () { + string foo = "foo"; + var s = !foo; +}