PageRenderTime 25ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/t/basic/01string.t

http://github.com/NotFound/winxed
Unknown | 34 lines | 26 code | 8 blank | 0 comment | 0 complexity | 81db9b96b71afc2eb91b1d969b8b55e8 MD5 | raw file
 1#! winxed
 2
 3// Basic tests: string type
 4
 5using extern Test.More plan, is;
 6
 7function main()
 8{
 9    plan(6);
10
11    string r;
12    string s1= "a";
13    string s2= "b";
14    string s3= "c";
15    string s4= "d";
16
17    // Concatenation
18    r = s1 + s2;
19    is(r, "ab", "concat 2");
20    r = s1 + s2 + s3;
21    is(r, "abc", "concat 3");
22    r = (s1 + s2) + (s3 + s4);
23    is(r, "abcd", "concat with parens");
24
25    // String literals
26    is(length("hello\n"), 6, "length double quoted");
27
28    // Non-ascii strings
29    r = "ñÑáéíóú";
30    is(length(r), 7, "non-ascii string have correct lenght");
31    is(bytelength(r), 14, "non-ascii string have correct byte lenght");
32}
33
34// End