[vala] Add regression tests for commit 5319240be4724f1
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Add regression tests for commit 5319240be4724f1
- Date: Thu, 8 Sep 2011 11:18:59 +0000 (UTC)
commit 3b4de64aa6ec2999699c2b31700a096057ab1a55
Author: Luca Bruno <lucabru src gnome org>
Date: Thu Sep 8 13:16:06 2011 +0200
Add regression tests for commit 5319240be4724f1
tests/basic-types/arrays.vala | 10 ++++++++++
tests/structs/structs.vala | 3 +++
2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tests/basic-types/arrays.vala b/tests/basic-types/arrays.vala
index 27efbad..708f246 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -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 ();
}
diff --git a/tests/structs/structs.vala b/tests/structs/structs.vala
index 2e4ed7c..543975a 100644
--- a/tests/structs/structs.vala
+++ b/tests/structs/structs.vala
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]