[vala-tests] tests: add bug 600564



commit 6a4897d9a7db5e608439618d25a300a6707e7884
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Thu Apr 8 00:17:12 2010 +0200

    tests: add bug 600564

 tests/bugs/600564.test |    3 +++
 tests/bugs/600564.vala |   31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/tests/bugs/600564.test b/tests/bugs/600564.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/bugs/600564.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/bugs/600564.vala b/tests/bugs/600564.vala
new file mode 100644
index 0000000..7b5a27c
--- /dev/null
+++ b/tests/bugs/600564.vala
@@ -0,0 +1,31 @@
+public struct Struct
+{
+        public string a;
+        public int b;
+}
+
+public Struct[] createArray()
+{
+        var array = new Struct[] {};
+        array += Struct() { a = "Hello", b = 10 };
+        array += Struct() { a = "World", b = 42 };
+        return array;
+}
+
+public class Klass
+{
+        public Struct[] arrayOfStruct { get; set; }
+        public void run()
+        {
+                arrayOfStruct = createArray();
+        }
+}
+
+void main()
+{
+        var obj = new Klass();
+        obj.run();
+        assert( obj.arrayOfStruct != null );
+        assert( obj.arrayOfStruct[0].a == "Hello" );
+        assert( obj.arrayOfStruct[1].a == "World" );
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]