Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tests to make sure 1..* is a Range, while 1..*-1 is a WhateverCod…
…e that returns a Range when you evaluate it. Also tests for * + * * *.
  • Loading branch information
colomon committed Nov 17, 2010
1 parent e0961ad commit a3e9233
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion S02-builtin_data_types/whatever.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 55;
plan 62;

# L<S02/Built-In Data Types/"The * character as a standalone term captures the notion of">
# L<S02/Native types/"If any native type is explicitly initialized to">
Expand All @@ -27,6 +27,10 @@ is $x.(5), 4, 'and we can execute that Code';
ok *.abs ~~ Code, '*.abs is of type Code';
isa_ok *.abs, WhateverCode, '... WhateverCode, more specifically';

isa_ok 1..*, Range, '1..* is a Range, not a Code';
#?rakudo 2 skip "1..*-1 not right yet"
isa_ok 1..*-1, WhateverCode, '1..*-1 is a WhateverCode';
isa_ok (1..*-1)(10), Range, '(1..*-1)(10) is a Range';

{
my @a = map *.abs, 1, -2, 3, -4;
Expand Down Expand Up @@ -100,6 +104,15 @@ isa_ok *.abs, WhateverCode, '... WhateverCode, more specifically';
is $c(0, -10, 3), 3, 'that can work with three different arguments';
}

#?rakudo skip "* + * * * badly broken at the moment"
{
my $c = * + * * *;
ok $c ~~ Code, '* + * * * generated a closure';
is $c(2, 2, 2), 6, '... that works';
is $c(-3, -3, -3), 6, '... that respects precdence';
is $c(3, 0, -10), 3, 'that can work with three different arguments';
}

#?rakudo skip 'RT 65482'
is (0,0,0,0,0,0) >>+>> ((1,2) xx *), <1 2 1 2 1 2>, 'xx * works';

Expand Down

0 comments on commit a3e9233

Please sign in to comment.