Skip to content
Newer
Older
100644 44 lines (32 sloc) 1016 Bytes
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
4 plan 15;
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");
21
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
22 # string context on undefined values
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
23 my $foo;
24 ok($foo eq "", "Undef eq ''");
25 ok($foo ne "f", "Undef ne 'f'");
26
27 my @foo;
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
28 ok(@foo[0] eq "", "Array Mu eq ''");
29 ok(@foo[0] ne "f", "Array Mu ne 'f'");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
30
31 # numeric equality & inequality
32 ok(2 == 2, "== true");
33 ok(!(2 == 3), "== false");
34 ok(2 != 3, "!= true");
35 ok(!(2 != 2), "!= false");
36
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
37 # numeric context on undefined values
38 ok($foo == 0, "Mu == 0");
39 ok(@foo[0] == 0, "Array Mu == 0");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
40
41 # XXX: need tests for coercion string and numeric coercions
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
42
43 # vim: ft=perl6
Something went wrong with that request. Please try again.