]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add regression tests for commit 5319240be4724f1
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 8 Sep 2011 11:16:06 +0000 (13:16 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 8 Sep 2011 11:16:06 +0000 (13:16 +0200)
tests/basic-types/arrays.vala
tests/structs/structs.vala

index 27efbad295ba0a1cc26c3130f92837d27c762be8..708f2469e04e0410886beb67f71263e75bec6eab 100644 (file)
@@ -91,11 +91,21 @@ void test_reference_transfer () {
        baz = (owned) bar;
 }
 
+void test_length_assignment () {
+       var a = new int[10];
+       var b = new int[20,30];
+       a.length = 8;
+       b.length[0] = 5;
+       assert (a.length == 8);
+       assert (b.length[0] == 5);
+}
+
 void main () {
        test_integer_array ();
        test_string_array ();
        test_array_pass ();
        test_static_array ();
        test_reference_transfer ();
+       test_length_assignment ();
 }
 
index 2e4ed7cb7bc4bf1d288d616a694e9639147d50c0..543975acae7f031bc7e215d074ded1982fa78240 100644 (file)
@@ -2,6 +2,7 @@ using GLib;
 
 struct SimpleStruct {
        public int field;
+       public int array[10];
 }
 
 public struct PublicStruct {
@@ -44,6 +45,7 @@ void test_in_nullable_parameter (SimpleStruct? st) {
 void test_ref_parameter (ref SimpleStruct st) {
        stdout.printf ("test_ref_parameter: st.field = %d\n", st.field);
        st.field++;
+       st.array[0] = 10;
 }
 
 void test_out_parameter (out SimpleStruct st) {
@@ -72,6 +74,7 @@ void main () {
        test_in_nullable_parameter (simple_struct);
        test_ref_parameter (ref simple_struct);
        stdout.printf ("after test_ref_parameter: st.field = %d\n", simple_struct.field);
+       assert (simple_struct.array[0] == 10);
        test_out_parameter (out simple_struct);
        stdout.printf ("after test_out_parameter: st.field = %d\n", simple_struct.field);