[vala/0.42] tests: Add some "yield" test to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] tests: Add some "yield" test to increase coverage
- Date: Sun, 23 Sep 2018 09:07:10 +0000 (UTC)
commit bc4108192642d3b684c70d3d45e8173f49f45689
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Sep 22 14:44:09 2018 +0200
tests: Add some "yield" test to increase coverage
tests/Makefile.am | 5 +++++
tests/parser/yield-return.vala | 19 +++++++++++++++++++
tests/semantic/yield-call-requires-async-context.test | 13 +++++++++++++
tests/semantic/yield-call-requires-async-method.test | 13 +++++++++++++
.../yield-creation-requires-async-context.test | 13 +++++++++++++
.../yield-creation-requires-async-method.test | 13 +++++++++++++
6 files changed, 76 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4cd23bb4b..da1b33169 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -482,6 +482,7 @@ TESTS = \
parser/unsupported-property-async.test \
parser/unsupported-property-throws.test \
parser/yield-method.test \
+ parser/yield-return.vala \
parser/bug728574.vala \
parser/bug749576.vala \
semantic/array-stacked.test \
@@ -602,6 +603,10 @@ TESTS = \
semantic/struct-field-initializer.test \
semantic/struct-invalid-base.test \
semantic/struct-recursive.test \
+ semantic/yield-call-requires-async-context.test \
+ semantic/yield-call-requires-async-method.test \
+ semantic/yield-creation-requires-async-context.test \
+ semantic/yield-creation-requires-async-method.test \
$(NULL)
NON_NULL_TESTS = \
diff --git a/tests/parser/yield-return.vala b/tests/parser/yield-return.vala
new file mode 100644
index 000000000..db3296944
--- /dev/null
+++ b/tests/parser/yield-return.vala
@@ -0,0 +1,19 @@
+class Foo {
+ public async Foo () {
+ }
+}
+
+async string foo () {
+ return "foo";
+}
+
+async Foo bar () {
+ return yield new Foo ();
+}
+
+async string baz () {
+ return yield foo ();
+}
+
+void main () {
+}
diff --git a/tests/semantic/yield-call-requires-async-context.test
b/tests/semantic/yield-call-requires-async-context.test
new file mode 100644
index 000000000..4b983a5c9
--- /dev/null
+++ b/tests/semantic/yield-call-requires-async-context.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+ async void foo () {
+ }
+
+ void bar () {
+ yield foo ();
+ }
+}
+
+void main () {
+}
diff --git a/tests/semantic/yield-call-requires-async-method.test
b/tests/semantic/yield-call-requires-async-method.test
new file mode 100644
index 000000000..0ed9017a6
--- /dev/null
+++ b/tests/semantic/yield-call-requires-async-method.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+ void foo () {
+ }
+
+ async void bar () {
+ yield foo ();
+ }
+}
+
+void main () {
+}
diff --git a/tests/semantic/yield-creation-requires-async-context.test
b/tests/semantic/yield-creation-requires-async-context.test
new file mode 100644
index 000000000..1dd780db9
--- /dev/null
+++ b/tests/semantic/yield-creation-requires-async-context.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+ public async Foo () {
+ }
+
+ void bar () {
+ yield new Foo ();
+ }
+}
+
+void main () {
+}
diff --git a/tests/semantic/yield-creation-requires-async-method.test
b/tests/semantic/yield-creation-requires-async-method.test
new file mode 100644
index 000000000..72d1d3c10
--- /dev/null
+++ b/tests/semantic/yield-creation-requires-async-method.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+ public Foo () {
+ }
+
+ async void bar () {
+ yield new Foo ();
+ }
+}
+
+void main () {
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]