girparser: Fix unowned keyword in metadata types
[vala-lang.git] / tests / basic-types / pointers.vala
blob7517e71b058980a219c68105308c47c50ca375c8
1 using GLib;
3 struct SimpleStruct {
4 public int field;
6 public int test () {
7 return field;
10 public static void main () {
11 SimpleStruct* st = new SimpleStruct[1];
12 st->field = 1;
13 assert (st->field == st->test ());
14 delete st;
16 test_pointers_element_access ();
17 test_pointers_return_value ();
20 static void test_pointers_element_access () {
21 int* array = new int[42];
22 array[0] = 23;
23 assert (array[0] == 23);
24 delete array;
27 const int[] array = { 42 };
29 static int* return_pointer () {
30 return array;
33 static void test_pointers_return_value () {
34 int i = return_pointer ()[0];
35 assert (i == 42);
39 void main () {
40 SimpleStruct.main ();