Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 72 lines (58 sloc) 2.425 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
f3f35ac @coke niecza fudging
coke authored
42 #?niecza skip 'No value for parameter $r in CORE infix:<==>'
454fdc3 @coke pugs fudge
coke authored
43 #?pugs skip 'Non-exhaustive patterns in lambda'
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
44 ok infix:<==>(False), "== with one argument is correct";
f3f35ac @coke niecza fudging
coke authored
45 #?niecza skip 'No value for parameter $l in CORE infix:<==>'
454fdc3 @coke pugs fudge
coke authored
46 #?pugs skip 'Missing required parameters: $?2 $?1'
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
47 ok infix:<==>(), "== with no arguments is correct";
f3f35ac @coke niecza fudging
coke authored
48 #?niecza skip 'No value for parameter $r in CORE infix:<!=>'
454fdc3 @coke pugs fudge
coke authored
49 #?pugs skip 'Non-exhaustive patterns in lambda'
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
50 ok infix:<!=>(False), "!= with one argument is correct";
f3f35ac @coke niecza fudging
coke authored
51 #?niecza skip 'No value for parameter $l in CORE infix:<!=>'
454fdc3 @coke pugs fudge
coke authored
52 #?pugs skip 'Missing required parameters: $?2 $?1'
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored
53 ok infix:<!=>(), "!= with no arguments is correct";
54
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored
55 #L<S03/Negated relational operators>
d052ec4 [t/spec] Add !== tests to S03-operators/equality.t
unobe authored
56 ok(2 !== 3, "!== true");
57 ok(!(2 !== 2), "!== false");
884261e [t/spec] Added equality tests and unfudged !== tests
unobe authored
58 ok($foo !eq "f", "!eq true undef");
59 ok("" !eq "f", "!eq true empty string");
60 ok(!($foo !eq ""), "!eq false undef and empty string");
61 ok(!($foo !eq $foo), "!eq false undef twice");
62 ok(!("" !eq ""), "!eq false empty string twice");
63 ok(!("xc" !eq "xc"), "!eq false non-empty string twice");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
64
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
65 # numeric context on undefined values
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored
66 ok($foo == 0, "Any == 0");
67 ok(@foo[0] == 0, "Array Any == 0");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored
68
69 # XXX: need tests for coercion string and numeric coercions
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored
70
71 # vim: ft=perl6
Something went wrong with that request. Please try again.