3 class Maman
.Foo
: Object
{
5 const string[] array_field
= {"1", "2"};
7 /* Does not work, because of bug 516287
8 static const public string s1_field = "1" + "2";
9 static const string s2_field = "1" + "2";
12 static void test_string_initializers () {
13 /* Does not work yet. bug 530623
15 const string s1 = "1";
19 /* Does not work yet. bug 530623 and bug 516287
20 // Local constant with string concatenation
21 const string s2 = "1" + "2";
26 string[] array1
= {"1", "2"};
28 assert (array1
[0] == "1");
29 assert (array1
[1] == "2");
30 assert (array1
.length
== 2);
33 assert (array_field
[0] == "1");
34 assert (array_field
[1] == "2");
35 assert (array_field
.length
== 2);
37 /* Does not work, because of bug 516287
38 // const field string with concatenation
39 assert (s1_field == "12");
40 assert (s2_field == "12");
43 static void test_string_operators () {
44 // string == operator compares content not reference
50 // allow null string comparison
57 static int main (string[] args
) {
58 stdout
.printf ("String Test: 1");
60 stdout
.printf (" 2" + " 3");
64 stdout
.printf ("%s", s
);
66 string t
= " 5 6 7 8".substring (2, 4);
67 stdout
.printf ("%s", t
);
69 stdout
.printf (" 8\n");
71 test_string_operators ();
72 test_string_initializers ();