Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 64 lines (50 sloc) 1.983 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
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
4 plan 32;
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 ok($foo eq "", "Any eq ''");
30 ok($foo ne "f", "Any ne 'f'");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
31
32 my @foo;
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
33 ok(@foo[0] eq "", "Array Any eq ''");
34 ok(@foo[0] ne "f", "Array Any ne 'f'");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
35
36 # numeric equality & inequality
37 ok(2 == 2, "== true");
38 ok(!(2 == 3), "== false");
39 ok(2 != 3, "!= true");
40 ok(!(2 != 2), "!= false");
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored
41
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
42 ok infix:<==>(False), "== with one argument is correct";
43 ok infix:<==>(), "== with no arguments is correct";
44 ok infix:<!=>(False), "!= with one argument is correct";
45 ok infix:<!=>(), "!= with no arguments is correct";
46
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored
47 #L<S03/Negated relational operators>
d052ec4 [t/spec] Add !== tests to S03-operators/equality.t
unobe authored
48 ok(2 !== 3, "!== true");
49 ok(!(2 !== 2), "!== false");
884261e [t/spec] Added equality tests and unfudged !== tests
unobe authored
50 ok($foo !eq "f", "!eq true undef");
51 ok("" !eq "f", "!eq true empty string");
52 ok(!($foo !eq ""), "!eq false undef and empty string");
53 ok(!($foo !eq $foo), "!eq false undef twice");
54 ok(!("" !eq ""), "!eq false empty string twice");
55 ok(!("xc" !eq "xc"), "!eq false non-empty string twice");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
56
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
57 # numeric context on undefined values
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
58 ok($foo == 0, "Any == 0");
59 ok(@foo[0] == 0, "Array Any == 0");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
60
61 # XXX: need tests for coercion string and numeric coercions
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
62
63 # vim: ft=perl6
Something went wrong with that request. Please try again.