[vala/staging: 6/8] tests: Add more "invalid expression" tests to increase coverage



commit 4f21af865b75a92cddd2a017085111d2c7c616e1
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Sep 24 13:21:44 2019 +0200

    tests: Add more "invalid expression" tests to increase coverage

 tests/Makefile.am                                          | 9 +++++++++
 tests/semantic/pointer-indirection-type-not-supported.test | 6 ++++++
 tests/semantic/pointer-indirection-void-not-supported.test | 6 ++++++
 tests/semantic/reference-transfer-not-supported.test       | 9 +++++++++
 tests/semantic/reference-transfer-unavailable.test         | 7 +++++++
 tests/semantic/throw-no-error-type.test                    | 8 ++++++++
 tests/semantic/unary-unsupported-complement.test           | 6 ++++++
 tests/semantic/unary-unsupported-increment.test            | 6 ++++++
 tests/semantic/unary-unsupported-minus.test                | 6 ++++++
 tests/semantic/unary-unsupported-negation.test             | 6 ++++++
 10 files changed, 69 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4eb13b120..bb374221a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -725,6 +725,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 \
@@ -739,6 +741,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 \
@@ -752,7 +756,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;
+}


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