Skip to content
Newer
Older
100644 83 lines (67 sloc) 2.99 KB
58135b3 [t/spec] changed 'use v6-alpha;' to 'use v6;'
moritz authored May 8, 2008
1 use v6;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored Jan 2, 2008
2 use Test;
3
d62254b @TimToady test all variants of == and != for 0 and 1-ary
TimToady authored Oct 31, 2015
4 plan 46;
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored Jan 2, 2008
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 Mar 16, 2010
21 ok(!("\0" eq "\0\0"), "!eq on strings with null chars but different lengths");
9bd177b [S03/equality.t] missing semis
lwall authored Mar 16, 2010
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 Jan 2, 2008
26
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored Nov 25, 2009
27 # string context on undefined values
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored Jan 2, 2008
28 my $foo;
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored Mar 1, 2010
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 Jan 2, 2008
31
32 my @foo;
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored Mar 1, 2010
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 Jan 2, 2008
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 Mar 17, 2010
41
f3f35ac @coke niecza fudging
coke authored Sep 28, 2011
42 #?niecza skip 'No value for parameter $r in CORE infix:<==>'
d62254b @TimToady test all variants of == and != for 0 and 1-ary
TimToady authored Oct 31, 2015
43 {
44 ok &infix:<==>(False), "&infix:<==> with one argument is correct";
45 ok &infix:<==>(), "&infix:<==> with no arguments is correct";
46 ok &infix:<!=>(False), "&infix:<!=> with one argument is correct";
47 ok &infix:<!=>(), "&infix:<!=> with no arguments is correct";
48 ok &infix:<!==>(False),"&infix:<!==> with one argument is correct";
49 ok &infix:<!==>(), "&infix:<!==> with no arguments is correct";
50
51 ok infix:<==>(False), "infix:<==> with one argument is correct";
52 ok infix:<==>(), "infix:<==> with no arguments is correct";
53 ok infix:<!=>(False), "infix:<!=> with one argument is correct";
54 ok infix:<!=>(), "infix:<!=> with no arguments is correct";
55 ok infix:<!==>(False), "infix:<!==> with one argument is correct";
56 ok infix:<!==>(), "infix:<!==> with no arguments is correct";
57
58 ok &[==](False), "&[==] with one argument is correct";
59 ok &[==](), "&[==] with no arguments is correct";
60 ok &[!=](False), "&[!=] with one argument is correct";
61 ok &[!=](), "&[!=] with no arguments is correct";
62 ok &[!==](False), "&[!==] with one argument is correct";
63 ok &[!==](), "&[!==] with no arguments is correct";
64 }
16c3770 @colomon Add tests for single argument versions of infix:<==> and infix:<!=>.
colomon authored Jul 6, 2011
65
c5f4109 [t/spec] Add !eq tests to S03-operators/equality.t
unobe authored Mar 17, 2010
66 #L<S03/Negated relational operators>
d052ec4 [t/spec] Add !== tests to S03-operators/equality.t
unobe authored Mar 17, 2010
67 ok(2 !== 3, "!== true");
68 ok(!(2 !== 2), "!== false");
884261e [t/spec] Added equality tests and unfudged !== tests
unobe authored Mar 17, 2010
69 ok($foo !eq "f", "!eq true undef");
70 ok("" !eq "f", "!eq true empty string");
71 ok(!($foo !eq ""), "!eq false undef and empty string");
72 ok(!($foo !eq $foo), "!eq false undef twice");
73 ok(!("" !eq ""), "!eq false empty string twice");
74 ok(!("xc" !eq "xc"), "!eq false non-empty string twice");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored Jan 2, 2008
75
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored Nov 25, 2009
76 # numeric context on undefined values
2563151 [t/spec] Refudge for Rakudo, and change Mu to Any in descriptions acc…
colomon authored Mar 1, 2010
77 ok($foo == 0, "Any == 0");
78 ok(@foo[0] == 0, "Array Any == 0");
8a1a068 Some initial test refactors and cleanups for basic operators.
pmichaud authored Jan 2, 2008
79
80 # XXX: need tests for coercion string and numeric coercions
7f29bc5 [t/spec] Add vim: lines everywhere.
kyle authored Aug 8, 2009
81
82 # vim: ft=perl6
Something went wrong with that request. Please try again.