Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t] and [t/spec]

 * moved NaN.t, ref.t, trusts.t and fail.t to spec/
 * merged tests from complex_powers.t into arith.t
 * replaced die_and_end.t with something more useful inside spec/
 * merge builtins/my.t into spec/S04-declarations/my.t
 * small simplifications to spec/S03-operators/p5arrow.t
 * removed quotes from isa_ok(..., 'QuotedType') 
 * various unfudges for rakudo
 * added tests for binding to signatures
 * added tests for KeyHash
 * added TASKS
 * [examples/99problems]: simplified some of the tests
Merry Christmas!


git-svn-id: http://svn.pugscode.org/pugs@24607 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 207f13f6abb6124ca6a9340cf8f5b1c540570766 1 parent 5caad32
moritz authored
Showing with 606 additions and 116 deletions.
  1. +3 −3 S02-builtin_data_types/anon_block.t
  2. +0 −1  S02-builtin_data_types/array.t
  3. +11 −11 S02-builtin_data_types/hash.t
  4. +2 −2 S02-builtin_data_types/hash_ref.t
  5. +49 −0 S02-builtin_data_types/keyhash.t
  6. +2 −2 S02-builtin_data_types/mixed_multi_dimensional.t
  7. +3 −3 S02-builtin_data_types/multi_dimensional_array.t
  8. +21 −0 S02-builtin_data_types/nan.t
  9. +22 −26 S02-builtin_data_types/num.t
  10. +1 −1  S02-builtin_data_types/range.t
  11. +1 −1  S02-literals/hash-interpolation.t
  12. +4 −6 S02-literals/pairs.t
  13. +9 −3 S03-operators/arith.t
  14. +0 −2  S03-operators/assign.t
  15. +86 −0 S03-operators/basic-types.t
  16. +2 −2 S03-operators/context-forcers.t
  17. +3 −3 S03-operators/hyper.t
  18. +1 −1  S03-operators/numeric-context.t
  19. +3 −2 S03-operators/p5arrow.t
  20. +1 −1  S04-blocks-and-statements/pointy.t
  21. +41 −1 S04-declarations/my.t
  22. +8 −0 S04-exceptions/die-and-end.t
  23. +32 −0 S04-exceptions/fail.t
  24. +1 −1  S04-statements/do.t
  25. +2 −3 S04-statements/for-scope.t
  26. +2 −2 S04-statements/for.t
  27. +0 −1  S04-statements/gather.t
  28. +2 −2 S04-statements/next.t
  29. +12 −12 S04-statements/try.t
  30. +79 −0 S06-advanced_subroutine_features/return2.t
  31. +28 −0 S06-other/pairs-as-lvalues.t
  32. +2 −2 S06-signature/sub-ref.t
  33. +37 −0 S12-attributes/clone.t
  34. +114 −0 S12-methods/trusts.t
  35. +2 −2 S16-filehandles/dir.t
  36. +14 −14 S16-filehandles/io.t
  37. +1 −1  S16-unfiled/readline.t
  38. +1 −1  S29-list/map.t
  39. +4 −4 S29-list/reverse.t
View
6 S02-builtin_data_types/anon_block.t
@@ -37,15 +37,15 @@ is($anon_block(), 1, '{} <anon block> works');
{
# pointy subs
my $pointy_block = -> { 1 };
- isa_ok($pointy_block, 'Block');
+ isa_ok($pointy_block, Block);
is($pointy_block(), 1, '-> {} <"pointy" block> works');
my $pointy_block_w_arg = -> $arg { 1 + $arg };
- isa_ok($pointy_block_w_arg, 'Block');
+ isa_ok($pointy_block_w_arg, Block);
is($pointy_block_w_arg(3), 4, '-> $arg {} <"pointy" block w/args> works');
my $pointy_block_w_multiple_args = -> $arg1, $arg2 { $arg1 + $arg2 };
- isa_ok($pointy_block_w_multiple_args, 'Block');
+ isa_ok($pointy_block_w_multiple_args, Block);
is($pointy_block_w_multiple_args(3, 4), 7, '-> $arg1, $arg2 {} <"pointy" block w/multiple args> works');
my $pointy_block_nested = -> $a { -> $b { $a + $b }};
View
1  S02-builtin_data_types/array.t
@@ -150,7 +150,6 @@ my @array2 = ("test", 1, undef);
is ~@array12,'a b c d', "assignment to end index correctly alters the array";
}
-#?rakudo skip "no whatever star yet"
#?pugs skip "no whatever star yet"
{
my @array13 = ('a', 'b', 'c', 'd');
View
22 S02-builtin_data_types/hash.t
@@ -8,7 +8,7 @@ plan 58;
# L<S09/Hashes>
my %hash1;
-isa_ok(%hash1, 'Hash');
+isa_ok(%hash1, Hash);
%hash1{"one"} = 5;
is(%hash1{"one"}, 5, 'lvalue hash assignment works (w/ double quoted keys)');
@@ -22,26 +22,26 @@ is(%hash1<three>, 3, 'lvalue hash assignment works (w/ unquoted style <key>)');
# basic hash creation w/ comma seperated key/values
my %hash2 = ("one", 1);
-isa_ok(%hash2, 'Hash');
+isa_ok(%hash2, Hash);
is(%hash2{"one"}, 1, 'comma seperated key/value hash creation works');
is(%hash2<one>, 1, 'unquoted <key> fetching works');
my %hash3 = ("one", 1, "two", 2);
-isa_ok(%hash3, 'Hash');
+isa_ok(%hash3, Hash);
is(%hash3{"one"}, 1, 'comma seperated key/value hash creation works with more than one pair');
is(%hash3{"two"}, 2, 'comma seperated key/value hash creation works with more than one pair');
# basic hash creation w/ => seperated key/values (pairs?)
my %hash4;
-isa_ok(%hash4, 'Hash');
+isa_ok(%hash4, Hash);
%hash4 = ("key" => "value");
is(%hash4{"key"}, 'value', '(key => value) seperated key/value has creation works');
# hash slicing
my %hash5 = ("one", 1, "two", 2, "three", 3);
-isa_ok(%hash5, 'Hash');
+isa_ok(%hash5, Hash);
my @slice1 = %hash5{"one", "three"};
is(+@slice1, 2, 'got the right amount of values from the %hash{} slice');
@@ -70,7 +70,7 @@ is(%hash5<foo>[1], 1, 'value assigned successfully with arrayref in list context
# keys
my %hash6 = ("one", 1, "two", 2, "three", 3);
-isa_ok(%hash6, 'Hash');
+isa_ok(%hash6, Hash);
my @keys1 = sort keys %hash6;
is(+@keys1, 3, 'got the right number of keys');
@@ -87,7 +87,7 @@ is(@keys2[2], 'two', 'got the right key');
# values
my %hash7 = ("one", 1, "two", 2, "three", 3);
-isa_ok(%hash7, 'Hash');
+isa_ok(%hash7, Hash);
my @values1 = sort values %hash7;
is(+@values1, 3, 'got the right number of values');
@@ -104,7 +104,7 @@ is(@values1[2], 3, 'got the right values');
# misc stuff ...
my %hash8;
-isa_ok(%hash8, 'Hash');
+isa_ok(%hash8, Hash);
%hash8 = (:one, :key<value>, :three(3));
is(%hash8{'one'}, 1, 'colonpair :one');
is(%hash8{'key'}, 'value', 'colonpair :key<value>');
@@ -116,7 +116,7 @@ my $key;
my $val;
my %hash9;
-isa_ok(%hash9, 'Hash');
+isa_ok(%hash9, Hash);
%hash9{1} = 2;
for (%hash9.kv) -> $k,$v {
@@ -138,11 +138,11 @@ is(%hash10<1>, 2, "assignment of pointy qw to hash");
sub test1{
my %sane = hash ('a'=>'b');
- is(~%sane.WHAT,'Hash','%sane is a Hash');
+ is(~%sane.WHAT,Hash,'%sane is a Hash');
}
sub test2 (Hash %hash) returns Void {
- is(~%hash.WHAT,'Hash','%hash is a Hash');
+ is(~%hash.WHAT,Hash,'%hash is a Hash');
}
my %h = hash (a => 'b');
View
4 S02-builtin_data_types/hash_ref.t
@@ -25,14 +25,14 @@ plan 32;
# basic hash creation w/ comma seperated key/values
{
my $hash = hash("1st", 1);
- isa_ok $hash, 'Hash';
+ isa_ok $hash, Hash;
is $hash{"1st"}, 1, 'comma seperated key/value hash creation works';
is $hash<1st>, 1, 'unquoted <key> fetching works';
}
{
my $hash = hash("1st", 1, "2nd", 2);
- isa_ok $hash, 'Hash';
+ isa_ok $hash, Hash;
is $hash{"1st"}, 1,
'comma seperated key/value hash creation works with more than 1st pair';
is $hash{"2nd"}, 2,
View
49 S02-builtin_data_types/keyhash.t
@@ -0,0 +1,49 @@
+use v6;
+use Test;
+plan 18;
+
+# L<S02/Mutable types/"A KeyHash differs from a normal Hash">
+
+# untyped KeyHash
+{
+ my %h is KeyHash;
+
+ %h = (a => 1, b => 3, c => -1, d => 7);
+ is +%h.elems, 4, 'Inititalization worked';
+ lives_ok { %h<d> = 0 }, 'can set an item to 0';
+ is %h.elems, 3, '... and an item is gone';
+ is %h.keys.sort.join(''), 'abc', '... and the right one is gone';
+ %h<c>++;
+ is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it';
+ %h<a>--;
+ is ~%h.keys, 'b', '-- also removes items when they go to zero';
+ %h<b>--;
+ is ~%h.keys, 'b', '... but only if they go to zero';
+ %h<c> = 'abc';
+ is ~%h<b c>, '2 abc', 'can store a string as well';
+ %h<c> = '';
+ is +%h, 1, 'setting a value to the null string also removes it';
+ %h<b> = undef;
+ is %h, 0, 'setting a value to undef also removes it';
+ ok !%h, '... and the empty hash is false in boolean context';
+}
+
+# typed KeyHash
+{
+ my Int %h is KeyHash;
+
+ %h = (a => 1, b => 3, c => -1, d => 7);
+ is +%h.elems, 4, 'Inititalization worked';
+ lives_ok { %h<d> = 0 }, 'can set an item to 0';
+ is %h.elems, 3, '... and an item is gone';
+ is %h.keys.sort.join(''), 'abc', '... and the right one is gone';
+ %h<c>++;
+ is %h.keys.sort.join(''), 'ab', '++ on an item with -1 deletes it';
+ %h<a>--;
+ is ~%h.keys, 'b', '-- also removes items when they go to zero';
+ %h<b>--;
+ is ~%h.keys, 'b', '... but only if they go to zero';
+}
+
+
+# vim: ft=perl6
View
4 S02-builtin_data_types/mixed_multi_dimensional.t
@@ -66,7 +66,7 @@ Some deeper tests were already added.
is(+@array, 4, 'got 4 elements in the Array of Arrays');
is(@array[0], 1, 'got the right first element');
#?rakudo todo 'too eager list flattening'
- isa_ok(@array[1], 'Array');
+ isa_ok(@array[1], Array);
is(@array[1][0], 2, 'got the right second/first element');
is(@array[1][1], 3, 'got the right second/second element');
isa_ok(@array[2], Array);
@@ -102,7 +102,7 @@ Some deeper tests were already added.
# UNSPECCED
{ # Hash of Arrays
my %hash;
- isa_ok(%hash, 'Hash');
+ isa_ok(%hash, Hash);
%hash<key> = [ 1, 2, 3 ];
isa_ok(%hash<key>, Array);
View
6 S02-builtin_data_types/multi_dimensional_array.t
@@ -51,7 +51,7 @@ is($multi1[0], 1, 'got the right value at multi1 index 0');
is(+$multi1[1], 3, '+$multi1[1] works')
}
-isa_ok($multi1[1], 'List');
+isa_ok($multi1[1], List);
# multi-dimensional array slices
# L<S09/"Subscript and slice notation"/index value to each slice>
@@ -83,7 +83,7 @@ is(+$multi2, 2, 'the multi2 has 2 elements');
is(+$array, 3, 'multi2[0] has 3 elements');
is(+$multi2[0], 3, '+$multi2[0] works');
}
-isa_ok($multi2[0], 'List');
+isa_ok($multi2[0], List);
# slice
@@ -105,7 +105,7 @@ is($multi2[0][2], 3, 'got the right value at multi2 index 0,2');
is(+$array, 3, 'multi2[1] has 3 elements');
is(+$multi2[1], 3, '+$multi2[1] works');
}
-isa_ok($multi2[1], 'List');
+isa_ok($multi2[1], List);
# slice
View
21 S02-builtin_data_types/nan.t
@@ -0,0 +1,21 @@
+use v6;
+
+use Test;
+
+plan 6;
+
+# Undeterminate Math results
+# see L<"http://mathworld.wolfram.com/Indeterminate.html">
+# L<S02/"Built-In Data Types" /Perl 6 should by default make standard IEEE floating point concepts visible>
+
+is 0 * Inf , NaN, "0 * Inf";
+is Inf / Inf, NaN, "Inf / Inf";
+is Inf - Inf, NaN, "Inf - Inf";
+# if we say that 0**0 and Inf**0 both give 1 (sse below), then for which
+# number or limit whould $number ** 0 be different from 1? so maybe just say
+# that NaN ** 0 == 1?
+#?rakudo skip 'unspecced and inconsistent'
+is NaN ** 0, NaN, "NaN ** 0";
+
+is 0**0 , 1, "0**0 is 1, _not_ NaN";
+is Inf**0 , 1, "Inf**0 is 1, _not_ NaN";
View
48 S02-builtin_data_types/num.t
@@ -4,66 +4,60 @@ use Test;
#L<S02/Built-In Data Types/Perl intrinsically supports big integers>
-plan 47;
+plan 48;
{
my $a = 1; "$a";
- isa_ok($a, 'Int');
+ isa_ok($a, Int);
is($a, "1", '1 stringification works');
}
{
my $a = -1; "$a";
- isa_ok($a, 'Int');
+ isa_ok($a, Int);
is($a, "-1", '-1 stringification works');
}
#L<S02/Built-In Data Types/Rat supports arbitrary precision rational arithmetic>
+#?rakudo skip "no Rat yet"
{
- my $a = 1.0; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ my $a = 1 div 1;
+ isa_ok($a, Rat);
is($a, "1", '1.0 stringification works');
}
{
- my $a = -1.0; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ my $a = -1.0;
+ isa_ok($a, Num);
is($a, "-1", '-1 stringification works');
}
{
- my $a = 0.1; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ my $a = 0.1;
+ isa_ok($a, Num);
is($a, "0.1", '0.1 stringification works');
}
{
my $a = -0.1; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ isa_ok($a, Num);
is($a, "-0.1", '-0.1 stringification works');
}
{
my $a = 10.01; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ isa_ok($a, Num);
is($a, "10.01", '10.01 stringification works');
}
{
my $a = 1e3; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ ok $a ~~ Num, '1e3 conforms to Num';
is($a, "1000", '1e3 stringification works');
}
{
my $a = 10.01e3; "$a";
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ isa_ok($a, Num);
is($a, "10010", '10.01e3 stringification works');
}
@@ -71,19 +65,19 @@ plan 47;
{
my $a = 0b100; "$a";
- isa_ok($a, 'Int');
+ isa_ok($a, Int);
is($a, "4", '0b100 (binary) stringification works');
}
{
my $a = 0x100; "$a";
- isa_ok($a, 'Int');
+ isa_ok($a, Int);
is($a, "256", '0x100 (hex) stringification works');
}
{
my $a = 0o100; "$a";
- isa_ok($a, 'Int');
+ isa_ok($a, Int);
is($a, "64", '0o100 (octal) stringification works');
}
@@ -98,17 +92,19 @@ plan 47;
}
#L<S02/Built-In Data Types/Rat supports arbitrary precision rational arithmetic>
+#?rakudo skip 'Rat, infix:<div>'
+isa_ok(1 div 1, Rat);
+
{
my $a = 80000.0000000000000000000000000;
- #?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ isa_ok($a, Num);
ok($a == 80000.0, 'trailing zeros compare correctly');
}
{
my $a = 1.0000000000000000000000000000000000000000000000000000000000000000000e1;
#?rakudo todo "no Rat yet"
- isa_ok($a, 'Rat');
+ isa_ok($a, Rat);
ok($a == 10.0, 'trailing zeros compare correctly');
}
View
2  S02-builtin_data_types/range.t
@@ -24,7 +24,7 @@ is @r, [1, 2, 3, 4, 5], 'got the right array';
# Range of Str
my $r = 'a'..'c';
-isa_ok $r, 'Range';
+isa_ok $r, Range;
# XXX unspecced: exact value of Range.perl
is $r.perl, '"a".."c"', 'canonical representation';
my @r = $r;
View
2  S02-literals/hash-interpolation.t
@@ -11,7 +11,7 @@ plan 10;
is "<%hash<a>>", '<1>', '"<%hash<a>>" works';
}
-#?rakudo skip '"MMD function __concatenate not found for types (100, 80)"'
+#?rakudo todo 'interpolation with subscripts'
{
my $hash = { a => 1, b => 2 };
is "$hash<a>", 1, '"$hash<a>" works';
View
10 S02-literals/pairs.t
@@ -75,10 +75,9 @@ sub f3 ($a) { ~WHAT($a) }
my $pair = (a => 42);
is f3($pair), "Pair", 'a $pair is not treated magically...';
- # XXX investigate what [,] actually does, it has changed recently
#?pugs todo '[,]'
- #?rakudo skip 'reduce meta op'
- is f3([,] $pair), "Int", '...but [,] $pair is';
+ #?rakudo skip 'prefix:<|>'
+ is f3(|$pair), "Int", '...but |$pair is';
}
sub f4 ($a) { ~WHAT($a) }
@@ -86,9 +85,8 @@ sub get_pair () { (a => 42) }
{
is f4(get_pair()), "Pair", 'get_pair() is not treated magically...';
- #?pugs todo '[,]'
#?rakudo skip 'reduce meta op'
- is f4([,] get_pair()), "Int", '...but *get_pair() is';
+ is f4(|get_pair()), "Int", '...but |get_pair() is';
}
sub f5 ($a) { ~WHAT($a) }
@@ -98,7 +96,7 @@ sub f5 ($a) { ~WHAT($a) }
is f5(@array_of_pairs), "Array",
'an array of pairs is not treated magically...';
#?rakudo skip 'reduce meta op'
- is f5([,] @array_of_pairs), "Array", '...and [,] @array isn\'t either';
+ is f5(|@array_of_pairs), "Array", '...and |@array isn\'t either';
}
sub f6 ($a) { ~WHAT($a) }
View
12 S03-operators/arith.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 192;
+plan 194;
my $five = abs(-5);
@@ -37,10 +37,10 @@ sub tryeq_sloppy ($lhs, $rhs, $todo1 = '') {
$error /= $lhs; # Syntax highlighting fix
if ($todo) {
#&ok.nextwith($error <1e-9,$todo ~ " # " ~ $lhs ~ " is close to " ~ $rhs, :todo);
- ok($error <1e-9,$todo ~ " # " ~ $lhs ~ " is close to " ~ $rhs, :todo);
+ ok($error < 1e-9, $todo ~ " # " ~ $lhs ~ " is close to " ~ $rhs, :todo);
} else {
#&ok.nextwith($error <1e-9);
- ok($error <1e-9);
+ ok($error < 1e-9);
}
}
}
@@ -316,6 +316,12 @@ is_approx 2.2**2.2, 5.66669577875008;
is 1**0, 1;
is 1**1, 1;
+#?rakudo todo 'infix:<**> with complex numbers'
+{
+ is_approx(-1, (0 + 1i)**2, "i^2 == -1");
+ is_approx(-1, (0.7071067811865476 + -0.7071067811865475i)**4, "sqrt(-i)**4 ==-1" );
+}
+
{
# Inf
is Inf, Inf;
View
2  S03-operators/assign.t
@@ -182,7 +182,6 @@ plan 309;
is($s, $t, 'chained $ = % = list assignment');
}
-#?rakudo skip 'arrays on LHS of list assignment'
{
# (@b, @a) = (@a, @b) assignment
my (@a, @b);
@@ -194,7 +193,6 @@ plan 309;
is(@b[1], 2, '(@b, @a) = (@a, @b) assignment \@b[1]');
}
-#?rakudo skip "unknown reasons"
{
# (@b, @a) = @a, @b assignment
my (@a, @b);
View
86 S03-operators/basic-types.t
@@ -0,0 +1,86 @@
+use v6;
+
+use Test;
+
+plan 19;
+
+# WHAT() on basic types
+
+my $a;
+isa_ok($a, Any, 'it is an Any type');
+
+my @a;
+isa_ok(@a, Array, 'it is an Array type');
+ok @a ~~ Positional, 'An Array does Positional';
+
+my %a;
+isa_ok(%a, Hash, 'it is an Hash type');
+ok %a ~~ Associative, 'A Hash does Associative';
+
+# WHAT() on reference types
+
+my $b1 = [];
+isa_ok($b1, List, 'it is a List type');
+
+# this seems to be the only way to make a hash - ref at the moment
+my %b2 = ("one", 1); my $b2 = %b2;
+isa_ok($b2, Hash, 'it is a Hash type');
+
+# WHAT() on subroutines
+
+my $s1 = sub {};
+#?rakudo todo 'type Sub'
+isa_ok($s1, Sub, 'it is a Sub type');
+
+# See L<S02/"Built-in Data Types"> and especially L<A06/"The C<sub> form"> why {...} and ->
+# ... {...} aren't Subs, but Blocks (they're all Codes, though).
+# Quoting A06:
+# Code
+# ____________|________________
+# | |
+# Routine Block
+# ________________|_______________
+# | | | | | |
+# Sub Method Submethod Multi Rule Macro
+
+# L<S06/Anonymous hashes vs blocks>
+my $s2 = {};
+isa_ok($s2, Hash, 'it is a Hash type (bare block)');
+
+# L<S06/"Placeholder variables">
+my $s2a = { $^a };
+isa_ok($s2a, Block, 'it is a Parametric type (bare block with placeholder parameters)');
+
+#?rakudo skip 'pointy block as expression'
+{
+ my $s3 = -> {};
+ isa_ok($s3, Block, 'it is a Block type (pointy block)');
+}
+
+# WHAT() on different types of scalars
+
+my $int = 0;
+isa_ok($int, Int, 'it is an Int type');
+
+my $num = '';
+ok(+$num ~~ Num, 'it is an Num type');
+
+my $float = 0.5;
+isa_ok($float, Num, 'it is an Num type');
+#?rakudo skip 'infix:<div>, Rat'
+isa_ok(1 div 4, Rat, 'infix:<div> produces a Rat');
+
+my $string = "Hello World";
+isa_ok($string, Str, 'it is a Str type');
+
+my $bool = (0 == 0);
+isa_ok($bool, Bool, 'it is a Bool type');
+
+my $pair = ("foo" => "bar");
+isa_ok($pair, Pair, 'it is a Pair type');
+
+#?rakudo skip 'rx/.../'
+{
+ my $rule = rx/^hello\sworld$/;
+ isa_ok($rule, Regex, 'it is a Regex type');
+}
View
4 S03-operators/context-forcers.t
@@ -205,7 +205,7 @@ sub eval_elsewhere($code){ eval($code) }
ok 9.9 ~~ ^10, '9.99 is in ^10';
ok 10 !~~ ^10, '10 is not in ^10';
is (^10).elems, 10, '^10 has 10 elems';
- isa_ok ^10, 'Range';
+ isa_ok ^10, Range;
# now the same for ^@array, in which case prefix:<^>
# imposes numeric context
@@ -216,5 +216,5 @@ sub eval_elsewhere($code){ eval($code) }
ok 9.9 ~~ ^@a, '9.99 is in ^10';
ok 10 !~~ ^@a, '10 is not in ^10';
is (^@a).elems, 10, '^10 has 10 elems';
- isa_ok ^@a, 'Range';
+ isa_ok ^@a, Range;
}
View
6 S03-operators/hyper.t
@@ -110,7 +110,7 @@ my @e;
is(~@r, ~@e, "auto dimension upgrade on lhs ASCII notation");
}
-#?rakudo skip 'list level extension'
+#?rakudo todo 'list level extension'
{ # list level extension
@r = (1,2,3,4) >>+>> (1,2);
@e = (2,4,3,4);
@@ -157,7 +157,7 @@ my @e;
is(~@r, ~@e, "list-level element extension on lhs");
};
-#?rakudo skip '>>.'
+#?rakudo todo '>>.'
{ # unary postfix with integers
my @r;
eval '@r = (1, 4, 9)».sqrt';
@@ -170,7 +170,7 @@ my @e;
is(~@r, ~@e, "method call on integer list elements (ASCII)");
};
-#?rakudo skip '>>.'
+#?rakudo todo '>>.'
{ # unary postfix again, but with a twist
my @r;
eval '@r = ("f", "oo", "bar")».chars';
View
2  S03-operators/numeric-context.t
@@ -43,7 +43,7 @@ is(+'aInfo', 0, "+'aInfo' is 0");
is(+'aNaN', 0, "+'aNaN' is 0");
is(+'aNaNa', 0, "+'aNaNa' is 0");
-#?rakudo 2 skip 'Inf and NaN'
+#?rakudo 2 todo 'Inf and NaN'
is( Inf, 'Inf', "'Inf' is Inf");
is(-Inf, '-Inf', "'-Inf' is -Inf");
View
5 S03-operators/p5arrow.t
@@ -15,7 +15,7 @@ ok((1 p5=> 2) !~~ Pair, 'p5=> does not construct a Pair');
{
sub whatever {
- is(@_, <a b c d>, 'arguments passed via p5=> are positional, not named');
+ is(@_.join('|'), 'a|b|c|d', 'arguments passed via p5=> are positional, not named');
is(%_.keys.elems, 0, 'arguments passed via p5=> do not appear in %_');
}
@@ -25,4 +25,5 @@ ok((1 p5=> 2) !~~ Pair, 'p5=> does not construct a Pair');
# S03:1465 says that p5=> is the same as a comma
# We'll test that it doesn't quote the LHS.
-isnt(eval 'my @arr = abc p5=> def;', <abc def>, 'p5=> does not quote the LHS');
+#?rakudo skip 'Null PMC access in type()'
+isnt(eval('my @arr = abc p5=> def;'), <abc def>, 'p5=> does not quote the LHS');
View
2  S04-blocks-and-statements/pointy.t
@@ -35,7 +35,7 @@ my @a;
ok eval('@a = ("one", -> $x { $x**2 }, "three")'),
'pointy sub without preceding comma';
is @a[0], 'one', 'pointy sub in list previous argument';
-isa_ok @a[1], 'Code', 'pointy sub in list';
+isa_ok @a[1], Code, 'pointy sub in list';
is @a[2], 'three', 'pointy sub in list following argument';
View
42 S04-declarations/my.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 36;
+plan 47;
#L<S04/The Relationship of Blocks and Declarations/"declarations, all
# lexically scoped declarations are visible">
@@ -134,5 +134,45 @@ is(eval('my $x = 1, my $y = 2; $y'), 2, 'precedence of my wrt = and ,');
is ~@b, '3', 'push actually worked on @b';
}
+my $result;
+my $x = 0;
+#?rakudo skip 'last'
+{
+ while my $x = 1 { $result = $x; last };
+ is $result, 1, 'my in while cond seen from body';
+}
+
+#?rakudo skip 'last'
+is(eval('while my $x = 1 { last }; $x'), 1, 'my in while cond seen after');
+
+is(eval('if my $x = 1 { $x } else { 0 }'), 1, 'my in if cond seen from then');
+#?rakudo skip 'Null PMC access in type()'
+is(eval('if not my $x = 1 { 0 } else { $x }'), 1, 'my in if cond seen from else');
+is(eval('if my $x = 1 { 0 } else { 0 }; $x'), 1, 'my in if cond seen after');
+
+# check proper scoping of my in loop initializer
+
+#?rakudo 4 skip 'Null PMC access in type()'
+is(eval('loop (my $x = 1, my $y = 2; $x > 0; $x--) { $result = $x; last }; $result'), 1, '1st my in loop cond seen from body');
+is(eval('loop (my $x = 1, my $y = 2; $x > 0; $x--) { $result = $y; last }; $result'), 2, '2nd my in loop cond seen from body');
+is(eval('loop (my $x = 1, my $y = 2; $x > 0; $x--) { last }; $x'), 1, '1st my in loop cond seen after');
+is(eval('loop (my $x = 1, my $y = 2; $x > 0; $x--) { last }; $y'), 2, '2nd my in loop cond seen after');
+
+
+# check that declaring lexical twice is noop
+{
+ my $f;
+ $f = 5;
+ my $f;
+ is($f, 5, "two lexicals declared in scope is noop");
+}
+
+my $x = 42;
+{
+ my $x = $x;
+ is( $x, undef, 'my $x = $x; can not see the value of the outer $x');
+}
+
+
# vim: ft=perl6
View
8 S04-exceptions/die-and-end.t
@@ -0,0 +1,8 @@
+use v6;
+plan 1;
+
+my $x = 0;
+eval 'END { $x = 1 }; die "fatal";';
+is $x, 1, 'die() does not prevent END block from being run';
+
+# vim: ft=perl6
View
32 S04-exceptions/fail.t
@@ -0,0 +1,32 @@
+use v6;
+
+use Test;
+
+plan 4;
+
+# L<S04/Exceptions/The fail function>
+
+{
+ # "use fatal" is not standard, so we don't have to disable it here
+ my $was_after_fail = 0;
+ my $was_before_fail = 0;
+ my $sub = sub { $was_before_fail++; my $exception = fail 42; $was_after_fail++ };
+
+ my $unthrown_exception = $sub();
+ # Note: We don't further access $unthrown_exception, so it doesn't get thrown
+ is $was_before_fail, 1, "fail() doesn't cause our sub to not get executed";
+ is $was_after_fail, 0, "fail() causes our sub to return (1)";
+}
+
+#?rakudo skip '"use fatal"'
+{
+ my $was_after_fail = 0;
+ my $was_after_sub = 0;
+ my $sub = sub { fail 42; $was_after_fail++ };
+
+ use fatal;
+ try { $sub(); $was_after_sub++ };
+
+ is $was_after_fail, 0, "fail() causes our sub to return (2)";
+ is $was_after_sub, 0, "fail() causes our try{} to die";
+}
View
2  S04-statements/do.t
@@ -81,7 +81,7 @@ eval_dies_ok 'my $i; do { $i++ } given $i;',
}
# L<S04/The do-once loop/"can take" "loop control statements">
-#?rakudo skip 'next not implemented'
+#?rakudo todo 'next() should also work on do blocks (?)'
{
my $i;
do {
View
5 S04-statements/for-scope.t
@@ -43,15 +43,14 @@ for 1, 2 -> $_ {
is(@inside.join(""), "123", "lexical array properly initialized, round $_, two explicit \$_s");
}
-#?rakudo skip 'slurpies not working'
{
sub respect(*@a) {
my @b = ();
- push @b for @a;
+ @b.push($_) for @a;
return @b.elems;
}
is respect(1,2,3), 3, 'a for loop inside a sub loops over each of the elements';
- is respect([1,2,3]), 3, '...even if they are sent as an array ref'; # is this right?
+ is respect([1,2,3]), 1, '... but only over one array ref';
is respect( my @a = 1, 2, 3 ), 3, '...and when the array is declared in the argument list';
}
View
4 S04-statements/for.t
@@ -52,15 +52,15 @@ plan 43;
}
# ... with referential sub
-#?rakudo skip 'parse error'
{
- my $d;
+ my $d = '';
class Int is also {
method some_meth_1 {
$d = $d ~ self
}
};
for 0 .. 5 { .some_meth_1 };
+ #?rakudo todo 'for loop and calss extension'
is($d, '012345', 'for 0 .. 5 { .some_sub } works');
}
View
1  S04-statements/gather.t
@@ -24,7 +24,6 @@ plan 12;
is(+@a, 5, "5 elements gathered");
ok($i, "gather code executed");
is(@a[0], 1, "first elem taken");
- #?rakudo skip '* not implemented'
is(@a[*-1], 5, "last elem taken");
};
View
4 S04-statements/next.t
@@ -114,7 +114,7 @@ Check that C<next> works on the correct loop/block
is($bar, "ABCCBCCABCCBCC", "next works on inner loop of 3");
}
-#?rakudo skip 'next on while-loops'
+#?rakudo todo 'next on while-loops'
{
my @log;
my $i = 0;
@@ -138,7 +138,7 @@ Check that C<next> works on the correct loop/block
is($i, 2, '$i++ executed only twice, because next ')
}
-#?rakudo skip 'next on loop-loops'
+#?rakudo todo 'next on loop-loops'
{
my $i = 0;
my $j;
View
24 S04-statements/try.t
@@ -100,14 +100,13 @@ plan 24;
# skip_rest "No Exception objects"; exit;
#}
-#?rakudo skip "CATCH blocks not implemented"
{
# exception classes
class Naughty is Exception {};
my ($not_died, $caught);
- eval 'try {
- die Naughty: "error"
+ try {
+ die Naughty("error");
$not_died = 1;
@@ -116,22 +115,22 @@ plan 24;
$caught = 1;
}
}
- }';
+ };
ok(!$not_died, "did not live after death");
#?pugs 1 todo
+ #?rakudo todo 'smart matching against exception'
ok($caught, "caught exception of class Naughty");
};
-#?rakudo skip "CATCH blocks not implemented"
{
# exception superclass
class Naughty::Specific is Naughty {};
class Naughty::Other is Naughty {};
my ($other, $naughty);
- eval 'try {
- die Naughty::Specific: "error";
+ try {
+ die Naughty::Specific("error");
CATCH {
when Naughty::Other {
@@ -141,21 +140,22 @@ plan 24;
$naughty = 1;
}
}
- }';
+ };
ok(!$other, "did not catch sibling error class");
#?pugs 1 todo
+ #?rakudo todo 'smart matching against exception'
ok($naughty, "caught superclass");
};
-#?rakudo skip "CATCH blocks not implemented"
+#?rakudo skip 'lexicals in eval()'
{
# uncaught class
- eval 'class Dandy is Exception {}';
+ class Dandy is Exception {};
my ($naughty, $lived);
- eval 'try {
- die Dandy: "error";
+ 'try {
+ die Dandy("error");
CATCH {
when Naughty {
View
79 S06-advanced_subroutine_features/return2.t
@@ -0,0 +1,79 @@
+use v6;
+
+use Test;
+
+# Basic &return tests
+# L<S06/"The C<return> function">
+
+plan 7;
+
+#?rakudo skip 'lexical subs'
+{
+ my sub userdefinedcontrol (&block) { &block(); return 24 }
+ my sub official {
+ userdefinedcontrol { return 42 };
+ }
+ is official(), 42, "bare blocks are invisible to return";
+}
+
+#?rakudo skip 'lexical subs'
+{
+ my sub userdefinedcontrol (&block) { &block(); return 24 }
+ my sub official {
+ {
+ {
+ userdefinedcontrol { return 42 };
+ }
+ }
+ }
+ is official(), 42, "nested bare blocks are invisible to return";
+}
+
+#?rakudo skip 'lexical subs'
+{
+ my sub userdefinedcontrol ($value, &block) { &block($value); return 24 }
+ my sub official($value) {
+ {
+ userdefinedcontrol $value, -> $x { return $x };
+ }
+ }
+ is official(42), 42, "pointy blocks are invisible to return";
+}
+
+# return should desugar to &?ROUTINE.leave, where &?ROUTINE is lexically scoped
+# to mean the current "official" subroutine or method.
+
+#?rakudo skip 'lexical subs'
+{
+ my sub userdefinedcontrol3 (&block) { &block(); return 36 }
+ my sub userdefinedcontrol2 (&block) { userdefinedcontrol3(&block); return 24 }
+ my sub userdefinedcontrol1 (&block) { userdefinedcontrol2(&block); return 12 }
+ my sub official {
+ userdefinedcontrol1 { return 42 };
+ }
+ is official(), 42,
+ "subcalls in user-defined control flow are invisible to return", :todo<bug>;
+}
+
+class Foo {
+ method userdefinedcontrol3 (&block) { &block(); 36 }
+ submethod userdefinedcontrol2 (&block) { $.userdefinedcontrol3(&block); 24 }
+ method userdefinedcontrol1 (&block) { $.userdefinedcontrol2(&block); 12 }
+ method officialmeth {
+ $.userdefinedcontrol1({ return 42 });
+ }
+ submethod officialsubmeth {
+ $.userdefinedcontrol1({ return 43 });
+ }
+ sub official {
+ Foo.userdefinedcontrol1({ return 44 });
+ }
+}
+
+#?pugs 3 todo 'return(), blocks and methods'
+is Foo.officialmeth(), 42,
+ "return correctly from official method only";
+is Foo.officialmeth(), 43,
+ "return correctly from official submethod only";
+is Foo::official(), 44,
+ "return correctly from official sub only";
View
28 S06-other/pairs-as-lvalues.t
@@ -0,0 +1,28 @@
+use v6;
+use Test;
+
+plan 5;
+
+# L<S06/Pairs as lvalues/>
+
+eval_dies_ok 'my $var; (key => $var) = "value"';
+
+{
+ my ($a, $b);
+ $b = 'b';
+ :(:$a) := $b;
+ is $a, 'b', 'can bind to single pair';
+ ok $a =:= $b, 'variables are bound together (?)';
+}
+
+{
+ my ($t, $m);
+ :(:type($t), :motivation($m)) := (type => 'geek', motivation => '-Ofun');
+ is $t, 'geek', 'bound to the first pair';
+ is $m, '-Ofun', 'bound ot the second pair';
+}
+
+
+
+
+# vim: ft=perl6
View
4 S06-signature/sub-ref.t
@@ -46,8 +46,8 @@ See L<S02/"Built-in Data Types"> for more information about Code, Routine, Sub,
{
my $foo = { 100 + $^x };
- isa_ok($foo, 'Code');
- isa_ok($foo, 'Block');
+ isa_ok($foo, Code);
+ isa_ok($foo, Block);
is $foo.(42), 142, "basic invocation of a pointy block with a param";
dies_ok { $foo.() }, "invocation of an parameterized block expecting a param without a param dies";
}
View
37 S12-attributes/clone.t
@@ -0,0 +1,37 @@
+use v6;
+
+use Test;
+
+plan 9;
+
+# L<S12/Construction and Initialization/You can clone an object, changing some of the attributes:>
+class Foo {
+ has $.attr;
+ method set_attr ($attr) { $.attr = $attr; }
+ method get_attr () { $.attr }
+}
+
+my $a = Foo.new(:attr(13));
+isa_ok($a, Foo);
+is($a.get_attr(), 13, '... got the right attr value');
+
+my $c = $a.clone();
+isa_ok($c, Foo);
+is($c.get_attr(), 13, '... cloned object retained attr value');
+my $val;
+lives_ok {
+ $val = $c === $a;
+}, "... cloned object isn't identity equal to the original object";
+ok($val.defined && !$val, "... cloned object isn't identity equal to the original object");
+
+my $d;
+lives_ok {
+ $d = $a.clone(attr => 42)
+}, '... cloning with supplying a new attribute value';
+
+my $val;
+lives_ok {
+ $val = $d.get_attr()
+}, '... getting attr from cloned value';
+
+is($val, 42, '... cloned object has proper attr value');
View
114 S12-methods/trusts.t
@@ -0,0 +1,114 @@
+use v6;
+
+use Test;
+
+# Referencing various parts of Synopsis 12.
+# L<S12/Multi dispatch/"if that other class has indicated that it trusts the
+# class">
+
+plan 15;
+
+class A {
+ trusts B;
+
+ has $!foo;
+ has @!bar;
+ has %!baz;
+}
+
+class B {
+ has A $!my_A;
+
+ submethod BUILD () {
+ my $an_A = A.new();
+
+ try {
+ $an_A!A::foo = 'hello';
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can set an A scalar attr; '~($!//'') );
+
+ try {
+ $an_A!A::bar = [1,2,3];
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can set an A array attr; '~($!//'') );
+
+ try {
+ $an_A!baz = {'m'=>'v'};
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can set an A hash attr; '~($!//'') );
+
+ $!my_A = $an_A;
+ }
+
+ method read_from_A() {
+ my ($foo, @bar, %baz);
+
+ try {
+ $foo = $an_A!A::foo;
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can get an A scalar attr; '~($!//''), :todo<feature> );
+ is( $foo, 'hello', 'value read by B from an A scalar var is correct', :todo<feature> );
+
+ try {
+ @bar = $an_A!A::bar;
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can get an A array attr; '~($!//''), :todo<feature> );
+ is_deeply( @bar, [1,2,3], 'value read by B from an A scalar var is correct', :todo<feature> );
+
+ try {
+ %baz = $an_A!A::baz;
+ };
+ is( $!.defined ?? 1 !! 0, 0, 'A trusts B, B can get an A hash attr; '~($!//''), :todo<feature> );
+ is_deeply( %baz, {'m'=>'v'}, 'value read by B from an A scalar var is correct', :todo<feature> );
+ }
+}
+
+class C {
+ has A $!my_A;
+
+ submethod BUILD () {
+ my $an_A = A.new();
+
+ try {
+ $an_A!A::foo = 'hello';
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not set an A scalar attr; '~($!//''), :todo<feature> );
+
+ try {
+ $an_A!A::bar = [1,2,3];
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not set an A array attr; '~($!//''), :todo<feature> );
+
+ try {
+ $an_A!A::baz = {'m'=>'v'};
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not set an A hash attr; '~($!//''), :todo<feature> );
+
+ $!my_A = $an_A;
+ }
+
+ method read_from_A() {
+ my ($foo, @bar, %baz);
+
+ try {
+ $foo = $an_A!A::foo;
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not get an A scalar attr; '~($!//'') );
+
+ try {
+ @bar = $an_A!A::bar;
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not get an A array attr; '~($!//'') );
+
+ try {
+ %baz = $an_A!A::baz;
+ };
+ is( $!.defined ?? 1 !! 0, 1, 'A does not trust C, C can not get an A hash attr; '~($!//'') );
+ }
+}
+
+my $my_B = B.new();
+$my_B.read_from_A();
+
+my $my_C = C.new();
+$my_C.read_from_A();
View
4 S16-filehandles/dir.t
@@ -82,7 +82,7 @@ ok(closedir($dir), "as does closedir");
my $dh = opendir($FindBin::Bin);
-isa_ok($dh, 'IO::Dir', "opendir worked");
+isa_ok($dh, IO::Dir, "opendir worked");
my @files_once_more = $dh.readdir;
is_deeply(@files_once_more.sort, @files.sort, 'same list of files,after reopen');
ok($dir.closedir, 'closedir using $dir.closedir format');
@@ -150,7 +150,7 @@ ok(close($dir_s), "as does close");
# closedir
my $dh_s = opendir($FindBin::Bin);
-isa_ok($dh_s, 'IO::Dir', "opendir worked");
+isa_ok($dh_s, IO::Dir, "opendir worked");
my @files_once_more_s = $dh_s.read;
is_deeply(@files_once_more_s.sort, @files_s.sort, 'same list of files,after reopen');
ok($dir_s.close, 'close using $dir.close format');
View
28 S16-filehandles/io.t
@@ -26,7 +26,7 @@ my $filename = 'tempfile' ~ nonce();
# create and write a file
my $out = open($filename, :w);
-isa_ok($out, 'IO');
+isa_ok($out, IO);
$out.say("Hello World");
$out.say("Foo Bar Baz");
$out.say("The End");
@@ -35,7 +35,7 @@ ok($out.close, 'file closed okay');
# read the file all possible ways
my $in1 = open($filename);
-isa_ok($in1, 'IO');
+isa_ok($in1, IO);
my $line1a = readline($in1);
is($line1a, "Hello World", 'readline($in) worked (and autochomps)');
my $line1b = readline($in1);
@@ -45,7 +45,7 @@ is($line1c, "The End", 'readline($in) worked');
ok($in1.close, 'file closed okay (1)');
my $in2 = open($filename);
-isa_ok($in2, 'IO');
+isa_ok($in2, IO);
my $line2a = $in2.readline();
is($line2a, "Hello World", '$in.readline() worked');
my $line2b = $in2.readline();
@@ -56,7 +56,7 @@ ok($in2.close, 'file closed okay (2)');
# L<S02/Files/you now write>
my $in3 = open($filename);
-isa_ok($in3, 'IO');
+isa_ok($in3, IO);
my $line3a = =$in3;
is($line3a, "Hello World", 'unary =$in worked');
my $line3b = =$in3;
@@ -68,14 +68,14 @@ ok($in3.close, 'file closed okay (3)');
# append to the file
my $append = open($filename, :a);
-isa_ok($append, 'IO');
+isa_ok($append, IO);
$append.say("... Its not over yet!");
ok($append.close, 'file closed okay (append)');
# now read in in list context
my $in4 = open($filename);
-isa_ok($in4, 'IO');
+isa_ok($in4, IO);
my @lines4 = readline($in4);
is(+@lines4, 4, 'we got four lines from the file');
is(@lines4[0], "Hello World", 'readline($in) worked in list context');
@@ -85,7 +85,7 @@ is(@lines4[3], "... Its not over yet!", 'readline($in) worked in list context');
ok($in4.close, 'file closed okay (4)');
my $in5 = open($filename);
-isa_ok($in5, 'IO');
+isa_ok($in5, IO);
my @lines5 = $in5.readline();
is(+@lines5, 4, 'we got four lines from the file');
is(@lines5[0], "Hello World", '$in.readline() worked in list context');
@@ -95,7 +95,7 @@ is(@lines5[3], "... Its not over yet!", '$in.readline() worked in list context')
ok($in5.close, 'file closed okay (5)');
my $in6 = open($filename);
-isa_ok($in6, 'IO');
+isa_ok($in6, IO);
my @lines6 = =$in6;
is(+@lines6, 4, 'we got four lines from the file');
is(@lines6[0], "Hello World", 'unary =$in worked in list context');
@@ -107,7 +107,7 @@ ok($in6.close, 'file closed okay (6)');
# test reading a file into an array and then closing before
# doing anything with the array (in other words, is pugs too lazy)
my $in7 = open($filename);
-isa_ok($in7, 'IO');
+isa_ok($in7, IO);
my @lines7 = readline($in7);
ok($in7.close, 'file closed okay (7)');
is(+@lines7, 4, 'we got four lines from the file (lazily)');
@@ -123,25 +123,25 @@ is(unlink($filename), 1, 'file has been removed');
# new file for testing other types of open() calls
my $out8 = open($filename, :w);
-isa_ok($out8, 'IO');
+isa_ok($out8, IO);
$out8.say("Hello World");
ok($out8.close, 'file closed okay (out8)');
my $in8 = open($filename);
-isa_ok($in8, 'IO');
+isa_ok($in8, IO);
my $line8_1 = readline($in8);
is($line8_1, "Hello World", 'readline($in) worked');
ok($in8.close, 'file closed okay (in8)');
my $fh9 = open($filename, :r, :w); # was "<+" ?
-isa_ok($fh9, 'IO');
+isa_ok($fh9, IO);
#my $line9_1 = readline($fh9);
#is($line9_1, "Hello World");
#$fh9.say("Second line");
ok($fh9.close, 'file closed okay (9)');
#my $in9 = open($filename);
-#isa_ok($in9, 'IO');
+#isa_ok($in9, IO);
#my $line9_1 = readline($in9);
#my $line9_2 = readline($in9);
#is($line9_1, "Hello World", 'readline($in) worked');
@@ -150,7 +150,7 @@ ok($fh9.close, 'file closed okay (9)');
#?rakudo skip ':rw on open() unimplemented'
{
my $fh10 = open($filename, :rw); # was "<+" ?
- isa_ok($fh10, 'IO');
+ isa_ok($fh10, IO);
#ok($fh10.close, 'file closed okay (10)');
}
View
2  S16-unfiled/readline.t
@@ -12,7 +12,7 @@ plan 3;
my $fh = open $*PROGRAM_NAME;
ok($fh, "could open self");
-isa_ok($fh, 'IO');
+isa_ok($fh, IO);
my $line;
eval '
View
2  S29-list/map.t
@@ -91,7 +91,7 @@ my @list = (1 .. 5);
'heuristic for block - looks like a closure';
my %result = map {; $_ => ($_*2) }, @list;
- isa_ok(%result, 'Hash');
+ isa_ok(%result, Hash);
is(%result<1>, 2, 'got the value we expected');
is(%result<2>, 4, 'got the value we expected');
is(%result<3>, 6, 'got the value we expected');
View
8 S29-list/reverse.t
@@ -98,9 +98,9 @@ is(@a, @e, "list was reversed");
{
my @a = "foo";
my @b = @a.reverse;
- isa_ok(@b, 'List');
+ isa_ok(@b, List);
my $b = @a.reverse;
- isa_ok($b, 'List');
+ isa_ok($b, List);
is(@b[0], "foo", 'our list is reversed properly');
is($b, "foo", 'in scalar context it is still a list');
is(@a[0], "foo", "original array left untouched");
@@ -111,9 +111,9 @@ is(@a, @e, "list was reversed");
{
my @a = ("foo", "bar");
my @b = @a.reverse;
- isa_ok(@b, 'List');
+ isa_ok(@b, List);
my $b = @a.reverse;
- isa_ok($b, 'List');
+ isa_ok($b, List);
is(@b[0], "bar", 'our array is reversed');
is(@b[1], "foo", 'our array is reversed');
Please sign in to comment.
Something went wrong with that request. Please try again.