Skip to content
Newer
Older
100644 57 lines (44 sloc) 1.56 KB
58135b3 [t/spec] changed 'use v6-alpha;' to 'use v6;'
moritz authored
1 use v6;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
2 use Test;
3
fe765a4 [S03/equality] make sure eq and ne don't do padding semantics
lwall authored
4 plan 20;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
5
6 # adapted from t/operators/eq.t and t/operators/cond.t
7 # relational ops are in relational.t
8 # cmp, leq, <=>, etc. are in comparison.t
9
10 #L<S03/Chaining binary precedence>
11 #L<S03/Comparison semantics>
12
13 # string equality & inequality
14 ok("a" eq "a", "eq true");
15 ok(!("a" eq "ab"), "eq false");
16 ok("a" ne "ab", "ne true");
17 ok(!("a" ne "a"), "ne false");
18
19 # potential problem cases
20 ok("\0" eq "\0", "eq on strings with null chars");
fe765a4 [S03/equality] make sure eq and ne don't do padding semantics
lwall authored
21 ok(!("\0" eq "\0\0"), "!eq on strings with null chars but different lengths");
9bd177b [S03/equality.t] missing semis
lwall authored
22 ok(!("a" eq "a\0"), "eq doesn't have null-padding semantics");
23 ok(!("a" eq "a "), "eq doesn't have space-padding semantics");
24 ok("a" ne "a\0", "ne doesn't have null-padding semantics");
25 ok("a" ne "a ", "ne doesn't have space-padding semantics");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
26
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
27 # string context on undefined values
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
28 my $foo;
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
29 #?rakudo todo "+Any() doesn't work yet"
30 ok($foo eq "", "Any eq ''");
31 ok($foo ne "f", "Any ne 'f'");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
32
33 my @foo;
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
34 ok(@foo[0] eq "", "Array Any eq ''");
35 ok(@foo[0] ne "f", "Array Any ne 'f'");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
36
37 # numeric equality & inequality
38 ok(2 == 2, "== true");
39 ok(!(2 == 3), "== false");
40 ok(2 != 3, "!= true");
41 ok(!(2 != 2), "!= false");
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored
42
43 #L<S03/Negated relational operators>
d052ec4 [t/spec] Add !== tests to S03-operators/equality.t
unobe authored
44 ok(2 !== 3, "!== true");
45 ok(!(2 !== 2), "!== false");
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored
46 ok($foo !eq "f", "!eq true");
47 ok(!($foo !eq ""), "!eq false");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
48
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
49 # numeric context on undefined values
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
50 #?rakudo skip "+Any doesn't work yet"
51 ok($foo == 0, "Any == 0");
52 ok(@foo[0] == 0, "Array Any == 0");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
53
54 # XXX: need tests for coercion string and numeric coercions
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
55
56 # vim: ft=perl6
Something went wrong with that request. Please try again.