[vala/wip/code-transformer: 26/27] test: Add "ownership mismatch" test for coalesce and conditional expression
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/code-transformer: 26/27] test: Add "ownership mismatch" test for coalesce and conditional expression
- Date: Fri, 19 Apr 2019 13:32:34 +0000 (UTC)
commit 05c8d02355701cc4ee53170e00e5ae8889ae78b9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Apr 14 10:24:18 2019 +0200
test: Add "ownership mismatch" test for coalesce and conditional expression
tests/Makefile.am | 2 ++
tests/control-flow/ownership-mismatch-coalesce.test | 11 +++++++++++
tests/control-flow/ownership-mismatch-conditional.test | 12 ++++++++++++
3 files changed, 25 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 27d80e860..0386292af 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -160,6 +160,8 @@ TESTS = \
control-flow/missing-break.test \
control-flow/missing-return.test \
control-flow/nested-conditional.vala \
+ control-flow/ownership-mismatch-coalesce.test \
+ control-flow/ownership-mismatch-conditional.test \
control-flow/switch.vala \
control-flow/sideeffects.vala \
control-flow/unassigned-captured-local-variable.test \
diff --git a/tests/control-flow/ownership-mismatch-coalesce.test
b/tests/control-flow/ownership-mismatch-coalesce.test
new file mode 100644
index 000000000..a0957e88b
--- /dev/null
+++ b/tests/control-flow/ownership-mismatch-coalesce.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+string? foo () {
+ return "foo";
+}
+
+void main () {
+ unowned string bar = "bar";
+
+ unowned string manam = foo () ?? bar;
+}
diff --git a/tests/control-flow/ownership-mismatch-conditional.test
b/tests/control-flow/ownership-mismatch-conditional.test
new file mode 100644
index 000000000..c9bfd2191
--- /dev/null
+++ b/tests/control-flow/ownership-mismatch-conditional.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+string? foo () {
+ return "foo";
+}
+
+void main () {
+ unowned string bar = "bar";
+ bool cond = true;
+
+ unowned string manam = cond ? foo () : bar;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]