codegen: Add destroy_local, destroy_parameter, and destroy_field
[vala-lang.git] / tests / control-flow / foreach.vala
blob396c9f19c889deda6fef4ac88ccb43f1ce5c83cf
1 void test_owned (ValueArray array) {
2 uint i = 0;
4 foreach (Value item in array) {
5 i++;
8 assert (i == 3);
11 void test_unowned (ValueArray array) {
12 uint i = 0;
14 foreach (unowned Value item in array) {
15 i++;
18 assert (i == 3);
21 void test_foreach_gvaluearray () {
22 Value value;
23 ValueArray array = new ValueArray (3);
25 value = 1;
26 array.append (value);
27 value = 2.0;
28 array.append (value);
29 value = "three";
30 array.append (value);
32 test_owned (array);
33 test_unowned (array);
36 void main () {
37 test_foreach_gvaluearray ();