[vala/0.36: 48/212] tests: Add regression test



commit 7aa299a2b13f90325e34489dfb745f3a70208635
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Feb 10 09:28:38 2016 +0100

    tests: Add regression test
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761736

 tests/Makefile.am                |    1 +
 tests/basic-types/bug761736.vala |   42 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a53e864..c5cc723 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,6 +42,7 @@ TESTS = \
        basic-types/bug731017.vala \
        basic-types/bug756376.vala \
        basic-types/bug761307.vala \
+       basic-types/bug761736.vala \
        basic-types/bug771626.test \
        basic-types/bug777697.test \
        chainup/class-base.vala \
diff --git a/tests/basic-types/bug761736.vala b/tests/basic-types/bug761736.vala
new file mode 100644
index 0000000..5be3bb1
--- /dev/null
+++ b/tests/basic-types/bug761736.vala
@@ -0,0 +1,42 @@
+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]