Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 82 lines (59 sloc) 2.654 kb
58135b3 [t/spec] changed 'use v6-alpha;' to 'use v6;'
moritz authored
1 use v6;
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
2
3 use Test;
4
b7f4853 point several smartlinks to the S32::Str specs
szabgab authored
5 # L<S32::Str/Str/=item length>
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
6
f660aa6 [t/spec] Possibly converted all remaining pod markers to pod6
cosimo authored
7 =begin pod
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
8
9 Various length tests (though "length" should not be used)
10
0b2448c length is not language dependent
wollmers authored
11 Don't mismatch "length" with the "width" property for Unicode characters.
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
12
13 L<"http://www.unicode.org/unicode/reports/tr11/">
14
f660aa6 [t/spec] Possibly converted all remaining pod markers to pod6
cosimo authored
15 =end pod
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
16
c84935c Added named arguments to string tests
frew authored
17 plan 58;
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
18
7795dfe [gsoc_spectest] More TASKS and fixed use of dies_ok (moritz++ for catchi...
Auzon authored
19 eval_dies_ok('"moose".length', 'Str.length properly not implemented');
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
20
21 # string literals, for sanity
22
b7f4853 point several smartlinks to the S32::Str specs
szabgab authored
23 # L<S32::Str/Str/=item bytes>
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
24
8dc7cca [spec] start marking string length tests for rakudo
particle authored
25 #?rakudo 3 skip '.bytes not implemented'
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
26 is("".bytes, 0, "empty string");
27 is("moose".bytes, 5, "moose");
c84935c Added named arguments to string tests
frew authored
28 is(bytes(:string('station')), 7, "bytes works with named argument");
8dc7cca [spec] start marking string length tests for rakudo
particle authored
29 my $x = undef;
061d002 [t/spec] various small improvements.
moritz authored
30 dies_ok { $x.bytes }, "undef.bytes fail()s";
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
31 # See thread "undef.chars" on p6l started by Ingo Blechschmidt:
32 # L<"http://www.nntp.perl.org/group/perl.perl6.language/22595">
33
b7f4853 point several smartlinks to the S32::Str specs
szabgab authored
34 # L<S32::Str/Str/=item chars>
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
35
36 # Precedence tests
37 ok (chars "abcdef" > 4), "chars() has the right precedence (1)";
38 is (chars("abcdef" > 4)), 0, "chars() has the right precedence (2)";
39
40 # and the real tests.
41
42 # Please add test strings in your favorite script, especially if
43 # it is boustrophedonic or otherwise interesting.
44 my @stringy = <@stringy>;
45 my @data = (
46 # string octets codepoints grapheme chars
47 "", 0, 0, 0, 0,
48 "moose", 5, 5, 5, 5,
bb281e2 [t/spec] Refactored some literal/unicode tests under S02/S29
cosimo authored
49 "møøse", 7, 5, 5, 5,
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
50 "C:\\Program Files", 16, 16, 16, 16,
51 ~@stringy, 8, 8, 8, 8,
52 "\x020ac \\x020ac", 11, 9, 9, 9,
53 "בדיקה", 10, 5, 5, 5,
54 "בדיקה 123", 14, 9, 9, 9,
55 "rántottcsirke", 14, 13, 13, 13,
56 "aáeéiíoóöőuúüű", 23, 14, 14, 14,
57 "AÁEÉIÍOÓÖŐUÚÜŰ", 23, 14, 14, 14,
58 "»«", 4, 2, 2, 2,
59 ">><<", 4, 4, 4, 4,
60
61 );
62 #:map { my %hash; %hash<string bytes codes graphs> = $_; \%hash };
63
b7f4853 point several smartlinks to the S32::Str specs
szabgab authored
64 # L<S32::Str/Str/=item bytes>
65 # L<S32::Str/Str/=item chars>
66 # L<S32::Str/Str/=item codes>
67 # L<S32::Str/Str/=item graphs>
d8d57b6 Test suite refactoring (spec/S29).
cosimo authored
68
69 for @data -> $string, $bytes, $codes, $graphs, $chars {
70 is($string.bytes, $bytes, "'{$string}'.bytes");
71 is($string.chars, $chars, "'{$string}'.chars");
72 is($string.codes, $codes, "'{$string}'.codes");
73 is($string.graphs, $graphs, "'{$string}'.graphs");
74 }
75
297e783 [t] and [t/spec]
moritz authored
76 # test something with a codepoint above 0xFFFF to catch errors that an
77 # UTF-16 based implementation might make
78
79 is '丽'.codes, 1, '.codes on a >0xFFFF char';
80 is '丽'.graphs, 1, '.graphs on a >0xFFFF char';
81
Something went wrong with that request. Please try again.