]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add some "yield" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 22 Sep 2018 12:44:09 +0000 (14:44 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 22 Sep 2018 12:44:29 +0000 (14:44 +0200)
tests/Makefile.am
tests/parser/yield-return.vala [new file with mode: 0644]
tests/semantic/yield-call-requires-async-context.test [new file with mode: 0644]
tests/semantic/yield-call-requires-async-method.test [new file with mode: 0644]
tests/semantic/yield-creation-requires-async-context.test [new file with mode: 0644]
tests/semantic/yield-creation-requires-async-method.test [new file with mode: 0644]

index 4cd23bb4b0eb75cffcaaeb2cf62665eff65de5a3..da1b3316946578e9aa14dafe7ae30b0050925daf 100644 (file)
@@ -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 (file)
index 0000000..db32969
--- /dev/null
@@ -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 (file)
index 0000000..4b983a5
--- /dev/null
@@ -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 (file)
index 0000000..0ed9017
--- /dev/null
@@ -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 (file)
index 0000000..1dd780d
--- /dev/null
@@ -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 (file)
index 0000000..72d1d3c
--- /dev/null
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+       public Foo () {
+       }
+
+       async void bar () {
+               yield new Foo ();
+       }
+}
+
+void main () {
+}