tests/basic/string-lit-2.sp
changeset 236 072f1114ea5d
child 263 ba85a47ee414
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tests/basic/string-lit-2.sp	Mon Dec 24 16:09:13 2012 -0800
     1.3 @@ -0,0 +1,26 @@
     1.4 +native PrintNum(num);
     1.5 +
     1.6 +f(x)
     1.7 +{
     1.8 +    new char:str1[];
     1.9 +    new char:str2[4];
    1.10 +
    1.11 +    str1 = "hello";
    1.12 +    str2 = "bye";
    1.13 +
    1.14 +    // Make sure modifying the string doesn't modify the
    1.15 +    // canonical literals.
    1.16 +    if (x) {
    1.17 +        str1[1] = 65;
    1.18 +        str2[1] = 68;
    1.19 +    }
    1.20 +
    1.21 +    PrintNum(str1[1]);
    1.22 +    PrintNum(str2[1]);
    1.23 +}
    1.24 +
    1.25 +public main()
    1.26 +{
    1.27 +    f(1);
    1.28 +    f(0);
    1.29 +}