[vala/staging: 1/3] tests: Add regression test for bug 761736
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/3] tests: Add regression test for bug 761736
- Date: Tue, 8 Mar 2016 16:37:43 +0000 (UTC)
commit b877a071352cf315fe84334a17ec54b2d7e2dd77
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Feb 10 09:28:38 2016 +0100
tests: Add regression test for bug 761736
tests/Makefile.am | 1 +
tests/basic-types/bug761736.vala | 45 ++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1666826..831da91 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -40,6 +40,7 @@ TESTS = \
basic-types/bug686336.vala \
basic-types/bug729907.vala \
basic-types/bug731017.vala \
+ basic-types/bug761736.vala \
namespaces.vala \
methods/lambda.vala \
methods/closures.vala \
diff --git a/tests/basic-types/bug761736.vala b/tests/basic-types/bug761736.vala
new file mode 100644
index 0000000..ed39a1f
--- /dev/null
+++ b/tests/basic-types/bug761736.vala
@@ -0,0 +1,45 @@
+const string[] FOO = { "foo", "bar" };
+
+unowned string[] transfer_none ()
+{
+ return FOO;
+}
+
+(unowned string)[] transfer_container ()
+{
+ return FOO;
+}
+
+string[] transfer_full ()
+{
+ return FOO;
+}
+
+void main() {
+ var bar = FOO;
+
+ for (int i = 0; i < 42; i++) {
+ string[] baz = bar;
+ }
+
+ for (int i = 0; i < 42; i++) {
+ unowned string[] a = transfer_none ();
+ assert ("foo" in a);
+ assert ("bar" in a);
+ }
+
+ for (int i = 0; i < 42; i++) {
+ (unowned string)[] a = transfer_container ();
+ assert ("foo" in a);
+ assert ("bar" in a);
+ }
+
+ for (int i = 0; i < 42; i++) {
+ string[] a = transfer_full ();
+ assert ("foo" in a);
+ assert ("bar" in a);
+ }
+
+ assert ("foo" in FOO);
+ assert ("bar" in FOO);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]