Changeset 21149
- Timestamp:
- 07/01/08 23:05:31 (3 months ago)
- Files:
-
- 1 modified
-
t/spec/S03-junctions/misc.t (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
t/spec/S03-junctions/misc.t
r21148 r21149 56 56 ok('c' eq ($c | $a | $b), 'junction of ($c | $a | $b) matches at least one "c"'); 57 57 58 #?rakudo 3 skip 'infix:<===>' 58 59 ok(not(('a' eq ($b | $c | $a)) === Bool::False), 'junctional comparison doesn not mistakenly return both true and false'); 59 60 ok(not(('b' eq ($a | $b | $c)) === Bool::False), 'junctional comparison doesn not mistakenly return both true and false'); … … 62 63 # test junction to junction 63 64 65 #?rakudo todo 'Compare junctions with junctions' 64 66 ok(('a' | 'b' | 'c') eq ($a & $b & $c), 'junction ("a" | "b" | "c") matches junction ($a & $b & $c)'); 65 67 ok(('a' & 'b' & 'c') eq ($a | $b | $c), 'junction ("a" & "b" & "c") matches junction ($a | $b | $c)'); … … 123 125 } 124 126 125 { 126 my ($j,$k,$l); 127 #?rakudo skip 'prefix:<\\>' 128 { 129 my $j; 130 my $k; 131 my $l; 127 132 128 133 $j = 1|2; … … 152 157 sub j (Junction $j) { return $j.perl } 153 158 159 #?rakudo skip 'Junction Authreading' 154 160 { 155 161 # L<S03/Junctive operators/They thread through operations> 156 my ($got, $want); 162 my $got; 163 my $want; 157 164 $got = ((1|2|3)+4); 158 165 $want = (5|6|7); … … 165 172 # L<S03/Junctive operators/This opens doors for constructions like> 166 173 # unless $roll == any(1..6) { print "Invalid roll" } 167 my ($roll, $note); 174 my $roll; 175 my $note; 168 176 $roll = 3; $note = ''; 169 177 unless $roll == any(1..6) { $note = "Invalid roll"; }; … … 185 193 186 194 # L<S03/Junctive operators/Junctions work through subscripting> 187 my ($got, @foo); 195 my $got; 196 my @foo; 188 197 $got = ''; @foo = (); 189 198 $got ~= 'y' if try { @foo[any(1,2,3)] }; … … 226 235 =end description 227 236 237 #?rakudo skip 'Junctions of Code Objects' 228 238 { 229 239 my @subs = (sub {3}, sub {2}); 230 240 231 my ($got, $want); 241 my $got; 242 my $want; 232 243 233 244 is(j(any(@subs)()), j(3|2), '.() on any() junction of subs'); … … 267 278 } 268 279 269 is(none(1).pick, undef, 'none(1).pick should be undef'); 270 is(none(1,1).pick, undef, 'none(1,1).pick should be undef'); 271 272 is(one(1).pick, 1, 'one(1).pick should be 1'); 273 is(one(1,1).pick, undef, 'one(1,1).pick should be undef'); 274 275 is(all(1).pick, 1, 'all(1).pick should be 1'); 276 is(all(1,1).pick, 1, 'all(1,1).pick should be 1'); 277 is(all(1,2).pick, undef, 'all(1,2).pick should be undef'); 280 #?rakudo skip 'Junction.pick' 281 { 282 is(none(1).pick, undef, 'none(1).pick should be undef'); 283 is(none(1,1).pick, undef, 'none(1,1).pick should be undef'); 284 285 is(one(1).pick, 1, 'one(1).pick should be 1'); 286 is(one(1,1).pick, undef, 'one(1,1).pick should be undef'); 287 288 is(all(1).pick, 1, 'all(1).pick should be 1'); 289 is(all(1,1).pick, 1, 'all(1,1).pick should be 1'); 290 is(all(1,2).pick, undef, 'all(1,2).pick should be undef'); 291 } 278 292 279 293 # junction in boolean context 280 294 ok(?(0&0) == ?(0&&0), 'boolean context'); 295 #?rakudo todo 'boolen context of junctions' 281 296 ok(?(0&1) == ?(0&&1), 'boolean context'); 282 297 ok(?(1&1) == ?(1&&1), 'boolean context'); 298 #?rakudo todo 'boolen context of junctions' 283 299 ok(?(1&0) == ?(1&&0), 'boolean context'); 284 300 ok(!(?(0&0) != ?(0&&0)), 'boolean context');
