Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 131 lines (104 sloc) 3.067 kB
f46eb61 set svn properties on all .t files below t/
moritz authored
1 use v6;
2 use Test;
3
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and…
Auzon authored
4 plan 40;
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
36 # Reference types
37 {
38 my @a = (1,2,3);
39 my @b = (1,2,3);
40
41 ok (\@a eqv \@a), "eqv on array references (1)";
42 ok (\@b eqv \@b), "eqv on array references (2)";
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
43 #?rakudo todo 'captures and infix:<eqv>'
f46eb61 set svn properties on all .t files below t/
moritz authored
44 ok !(\@a eqv \@b), "eqv on array references (3)";
45 }
46
47 {
48 my $a = \3;
49 my $b = \3;
50
51 ok ($a eqv $a), "eqv on scalar references (1-1)";
52 ok ($b eqv $b), "eqv on scalar references (1-2)";
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
53 #?rakudo todo 'captures and infix:<eqv>'
f46eb61 set svn properties on all .t files below t/
moritz authored
54 ok !($a eqv $b), "eqv on scalar references (1-3)";
55 }
56
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
57 #?
f46eb61 set svn properties on all .t files below t/
moritz authored
58 {
59 my $a = { 3 };
60 my $b = { 3 };
61
62 ok ($a eqv $a), "eqv on sub references (1-1)";
63 ok ($b eqv $b), "eqv on sub references (1-2)";
64 ok !($a eqv $b), "eqv on sub references (1-3)";
65 }
66
67 {
68 ok (&say eqv &say), "eqv on sub references (2-1)";
69 ok (&map eqv &map), "eqv on sub references (2-2)";
70 ok !(&say eqv &map), "eqv on sub references (2-3)";
71 }
72
73 {
74 my $num = 3;
75 my $a = \$num;
76 my $b = \$num;
77
78 ok ($a eqv $a), "eqv on scalar references (2-1)";
79 ok ($b eqv $b), "eqv on scalar references (2-2)";
80 ok ($a eqv $b), "eqv on scalar references (2-3)";
81 }
82
83 {
84 ok !([1,2,3] eqv [4,5,6]), "eqv on anonymous array references (1)";
85 #?pugs 2 todo 'bug'
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
86 #?rakudo 2 todo 'captures? test bug?'
f46eb61 set svn properties on all .t files below t/
moritz authored
87 ok !([1,2,3] eqv [1,2,3]), "eqv on anonymous array references (2)";
88 ok !([] eqv []), "eqv on anonymous array references (3)";
89 }
90
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
91 #?rakudo skip 'hashes'
f46eb61 set svn properties on all .t files below t/
moritz authored
92 {
93 ok !({a => 1} eqv {a => 2}), "eqv on anonymous hash references (1)";
94 ok !({a => 1} eqv {a => 1}), "eqv on anonymous hash references (2)";
95 }
96
01ef6c2 [t/spec] fudge eqv.t for rakudo
moritz authored
97 #?rakudo skip 'captures'
f46eb61 set svn properties on all .t files below t/
moritz authored
98 {
99 ok !(\3 eqv \4), "eqv on anonymous scalar references (1)";
100 #?pugs 2 todo 'bug'
101 ok !(\3 eqv \3), "eqv on anonymous scalar references (2)";
102 ok !(\undef eqv \undef), "eqv on anonymous scalar references (3)";
103 }
104
105 # Chained eqv (not specced, but obvious)
106 {
107 ok (3 eqv 3 eqv 3), "chained eqv (1)";
108 ok !(3 eqv 3 eqv 4), "chained eqv (2)";
109 }
110
111 # Subparam binding doesn't affect eqv test
112 {
113 my $foo;
114 my $test = -> $arg { $foo eqv $arg };
115
116 $foo = 3;
117 ok $test($foo), "subparam binding doesn't affect eqv (1)";
118 ok $test(3), "subparam binding doesn't affect eqv (2)";
119
120 ok !$test(4), "subparam binding doesn't affect eqv (3)";
121 my $bar = 4;
122 ok !$test($bar), "subparam binding doesn't affect eqv (4)";
123 }
124
9a58617 [gsoc_spectest] reorganization and a few more tests for ===, eqv, and…
Auzon authored
125 {
126 is(1 eqv 1, Bool::True, 'eqv returns Bool::True when true');
127 is(0 eqv 1, Bool::False, 'eqv returns Bool::False when false');
128 }
d7f4d0b [t/spec] a few more fixed smartlinks; down to 56 broken
moritz authored
129
130 # vim: ft=perl6
Something went wrong with that request. Please try again.