From: Rico Tzschichholz Date: Sat, 22 Sep 2018 12:44:09 +0000 (+0200) Subject: tests: Add some "yield" test to increase coverage X-Git-Tag: 0.43.1~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=105698a1b1d2ea721a98751fdbbc38c082012793;p=thirdparty%2Fvala.git tests: Add some "yield" test to increase coverage --- 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 () { +}