Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 166 lines (136 sloc) 4.404 kb
f46eb61 set svn properties on all .t files below t/
moritz authored
1 use v6;
2 use Test;
3
ca66c90 @colomon Instead of testing Mu eqv Mu and Mu !eqv Any, test that infix:<eqv> a…
colomon authored
4 plan 52;
f46eb61 set svn properties on all .t files below t/
moritz authored
5
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and…
Auzon authored
6 # L<S03/Comparison semantics/Binary eqv tests equality much like === does>
d7f4d0b [t/spec] a few more fixed smartlinks; down to 56 broken
moritz authored
7 # L<S32::Basics/Any/"=item eqv">
f46eb61 set svn properties on all .t files below t/
moritz authored
8
9 # eqv on values
10 {
11 ok (1 eqv 1), "eqv on values (1)";
12 ok (0 eqv 0), "eqv on values (2)";
13 ok !(0 eqv 1), "eqv on values (3)";
14 }
15
16 # Value types
17 {
18 my $a = 1;
19 my $b = 1;
20
21 ok $a eqv $a, "eqv on value types (1-1)";
22 ok $b eqv $b, "eqv on value types (1-2)";
23 ok $a eqv $b, "eqv on value types (1-3)";
24 }
25
26
27 {
28 my $a = 1;
29 my $b = 2;
30
31 ok ($a eqv $a), "eqv on value types (2-1)";
32 ok ($b eqv $b), "eqv on value types (2-2)";
33 ok !($a eqv $b), "eqv on value types (2-3)";
34 }
35
baed277 [t/spec] Tweak some fudge reasons.
jnthn authored
36 #?rakudo skip 'binding NYI'
f3f35ac @coke niecza fudging
coke authored
37 #?niecza skip 'Cannot use value like Capture as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
38 {
39 my @a = (1,2,3);
40 my @b = (1,2,3);
41
42 ok (\@a eqv \@a), "eqv on array references (1)";
43 ok (\@b eqv \@b), "eqv on array references (2)";
d4cb58c @coke pugs fudge
coke authored
44 #?pugs todo
f46eb61 set svn properties on all .t files below t/
moritz authored
45 ok !(\@a eqv \@b), "eqv on array references (3)";
0d22a8e [t/spec] correct and extend eqv.t
moritz authored
46 @a := @b;
47 ok \@a eqv \@b, '\@array of two bound arrays are eqv';
f46eb61 set svn properties on all .t files below t/
moritz authored
48 }
49
f3f35ac @coke niecza fudging
coke authored
50 #?niecza skip 'Cannot use value like Capture as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
51 {
52 my $a = \3;
53 my $b = \3;
54
0d22a8e [t/spec] correct and extend eqv.t
moritz authored
55 ok ($a eqv $a), "eqv on scalar references (1-1)";
56 ok ($b eqv $b), "eqv on scalar references (1-2)";
57 ok ($a eqv $b), "eqv on scalar references (1-3)";
baed277 [t/spec] Tweak some fudge reasons.
jnthn authored
58 #?rakudo skip 'infix:<!eqv>'
d4cb58c @coke pugs fudge
coke authored
59 #?pugs todo
0d22a8e [t/spec] correct and extend eqv.t
moritz authored
60 ok (\$a !eqv \$b), "eqv on scalar references (1-4)";
f46eb61 set svn properties on all .t files below t/
moritz authored
61 }
62
f3f35ac @coke niecza fudging
coke authored
63 #?niecza skip 'Cannot use value like Block as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
64 {
65 my $a = { 3 };
66 my $b = { 3 };
67
0d22a8e [t/spec] correct and extend eqv.t
moritz authored
68 ok ($a eqv $a), "eqv on sub references (1-1)";
69 ok ($b eqv $b), "eqv on sub references (1-2)";
5a51d4d @moritz correct an eqv test
moritz authored
70 # it's impossible to compare blocks for equivalence in general,
71 # and they have associations to different source locations
72 # (line number, column)
73 nok ($a eqv $b), "eqv on sub references (1-3)";
74 nok ($a eqv { 5 }), 'eqv on sub references (1-4)';
f46eb61 set svn properties on all .t files below t/
moritz authored
75 }
76
f3f35ac @coke niecza fudging
coke authored
77 #?niecza skip 'Cannot use value like Sub as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
78 {
79 ok (&say eqv &say), "eqv on sub references (2-1)";
80 ok (&map eqv &map), "eqv on sub references (2-2)";
81 ok !(&say eqv &map), "eqv on sub references (2-3)";
82 }
83
f3f35ac @coke niecza fudging
coke authored
84 #?niecza skip 'Cannot use value like Capture as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
85 {
1571369 test for RT #72872, Mu eqv Mu
moritz authored
86 my $num = 3; my $a = \$num;
f46eb61 set svn properties on all .t files below t/
moritz authored
87 my $b = \$num;
88
89 ok ($a eqv $a), "eqv on scalar references (2-1)";
90 ok ($b eqv $b), "eqv on scalar references (2-2)";
91 ok ($a eqv $b), "eqv on scalar references (2-3)";
92 }
93
94 {
4bdf17e @coke Convert niecza faux-todo to real todo.
coke authored
95 #?niecza todo
5a51d4d @moritz correct an eqv test
moritz authored
96 nok ([1,2,3] eqv [4,5,6]), "eqv on anonymous array references (1)";
0d22a8e [t/spec] correct and extend eqv.t
moritz authored
97 ok ([1,2,3] eqv [1,2,3]), "eqv on anonymous array references (2)";
98 ok ([] eqv []), "eqv on anonymous array references (3)";
f46eb61 set svn properties on all .t files below t/
moritz authored
99 }
100
101 {
4bdf17e @coke Convert niecza faux-todo to real todo.
coke authored
102 #?niecza todo
4081a4a [t/spec] fix and extend %h1 eqv %h2 tests
moritz authored
103 ok !({a => 1} eqv {a => 2}), "eqv on anonymous hash references (-)";
d4cb58c @coke pugs fudge
coke authored
104 #?pugs todo
4081a4a [t/spec] fix and extend %h1 eqv %h2 tests
moritz authored
105 ok ({a => 1} eqv {a => 1}), "eqv on anonymous hash references (+)";
d4cb58c @coke pugs fudge
coke authored
106 #?pugs todo
4081a4a [t/spec] fix and extend %h1 eqv %h2 tests
moritz authored
107 ok ({a => 2, b => 1} eqv { b => 1, a => 2}), 'order really does not matter';
108 ok !({a => 1} eqv {a => 1, b => 2}), 'hashes: different number of pairs';
f46eb61 set svn properties on all .t files below t/
moritz authored
109 }
110
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
111 #?rakudo skip 'captures'
f3f35ac @coke niecza fudging
coke authored
112 #?niecza skip 'Cannot use value like Capture as a number'
f46eb61 set svn properties on all .t files below t/
moritz authored
113 {
114 ok !(\3 eqv \4), "eqv on anonymous scalar references (1)";
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
115 # XXX the following seems bogus nowadays
ebb9ec5 @coke pugs unfudge
coke authored
116 #?pugs 2 todo
f46eb61 set svn properties on all .t files below t/
moritz authored
117 ok !(\3 eqv \3), "eqv on anonymous scalar references (2)";
8f9a119 [t/] unify compartmentalized undef and Object concepts into Mu
lwall authored
118 ok !(\Mu eqv \Mu), "eqv on anonymous scalar references (3)";
f46eb61 set svn properties on all .t files below t/
moritz authored
119 }
120
121 # Chained eqv (not specced, but obvious)
122 {
123 ok (3 eqv 3 eqv 3), "chained eqv (1)";
124 ok !(3 eqv 3 eqv 4), "chained eqv (2)";
125 }
126
127 # Subparam binding doesn't affect eqv test
128 {
129 my $foo;
130 my $test = -> $arg { $foo eqv $arg };
131
132 $foo = 3;
133 ok $test($foo), "subparam binding doesn't affect eqv (1)";
134 ok $test(3), "subparam binding doesn't affect eqv (2)";
135
136 ok !$test(4), "subparam binding doesn't affect eqv (3)";
137 my $bar = 4;
138 ok !$test($bar), "subparam binding doesn't affect eqv (4)";
139 }
140
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and…
Auzon authored
141 {
142 is(1 eqv 1, Bool::True, 'eqv returns Bool::True when true');
143 is(0 eqv 1, Bool::False, 'eqv returns Bool::False when false');
144 }
d7f4d0b [t/spec] a few more fixed smartlinks; down to 56 broken
moritz authored
145
1571369 test for RT #72872, Mu eqv Mu
moritz authored
146 {
147 is Any eqv Any, Bool::True, 'Any eqv Any';
ca66c90 @colomon Instead of testing Mu eqv Mu and Mu !eqv Any, test that infix:<eqv> a…
colomon authored
148 }
149
93b57c2 @coke pugs un/fudge
coke authored
150 #?pugs skip "autothreaded?"
ca66c90 @colomon Instead of testing Mu eqv Mu and Mu !eqv Any, test that infix:<eqv> a…
colomon authored
151 {
152 ok 'a' eqv any <a b c>, "eqv autothreads correctly";
1571369 test for RT #72872, Mu eqv Mu
moritz authored
153 }
154
b814b4d @moritz [eqv.t] tests for RT #75322
moritz authored
155 # RT #75322 - Rakudo used to be confused when lists began with ()
156 {
d4cb58c @coke pugs fudge
coke authored
157 #?niecza todo
b814b4d @moritz [eqv.t] tests for RT #75322
moritz authored
158 nok ((), "x") eqv ((), 9), 'list starting with () - 1';
159 nok ((), (), 1) eqv ((), 9), 'list starting with () - 1';
160 nok ((), (), (), 1) eqv ((), (), ""), 'list starting with () - 1';
161 nok ((), (), (), 1) eqv ((), 4), 'list starting with () - 1';
162 ok ((), ()) eqv ((), ()), '((), ())';
163 }
164
d7f4d0b [t/spec] a few more fixed smartlinks; down to 56 broken
moritz authored
165 # vim: ft=perl6
Something went wrong with that request. Please try again.