|
Revision 20490, 0.9 kB
(checked in by Auzon, 8 months ago)
|
|
s/use v6-alpha;$/use v6;/;
Also catching a few other mentions of v6-alpha.
|
-
Property svn:mime-type set to
text/plain; charset=UTF-8
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | use v6; |
|---|
| 2 | |
|---|
| 3 | use Test; |
|---|
| 4 | |
|---|
| 5 | plan(5); |
|---|
| 6 | |
|---|
| 7 | unless eval 'eval("1", :lang<perl5>)' { |
|---|
| 8 | skip_rest; |
|---|
| 9 | exit; |
|---|
| 10 | } |
|---|
| 11 | |
|---|
| 12 | eval(q/ |
|---|
| 13 | package Id; |
|---|
| 14 | sub new { |
|---|
| 15 | my ($class, $ref) = @_; |
|---|
| 16 | bless \$ref, $class; |
|---|
| 17 | } |
|---|
| 18 | sub identity { |
|---|
| 19 | my $self = shift; |
|---|
| 20 | return $$self; |
|---|
| 21 | } |
|---|
| 22 | /, :lang<perl5>); |
|---|
| 23 | |
|---|
| 24 | my $japh = { "Just another $_ hacker" }; |
|---|
| 25 | my $japh2 = -> $name { "Just another $name hacker" }; |
|---|
| 26 | my $id = eval('sub { Id->new($_[0]) }', :lang<perl5>); |
|---|
| 27 | |
|---|
| 28 | is($id($japh).identity.('Pugs'), 'Just another Pugs hacker', "Closure roundtrips"); |
|---|
| 29 | is($id($japh2).identity.('Pugs'), 'Just another Pugs hacker', "Closure roundtrips"); |
|---|
| 30 | |
|---|
| 31 | my $keys_p5 = eval('sub {keys %{$_[0]}}', :lang<perl5>); |
|---|
| 32 | my $tohash_p5 = eval('sub { return {map {$_ => 1} @_ } }', :lang<perl5>); |
|---|
| 33 | my %hash = (foo => 'bar', hate => 'software'); |
|---|
| 34 | { |
|---|
| 35 | my $foo = $tohash_p5.(keys %hash); |
|---|
| 36 | cmp_ok($foo, &infix:<cmp>, %hash); |
|---|
| 37 | is_deeply([$foo.keys].sort, [%hash.keys].sort); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | { |
|---|
| 41 | is_deeply([%hash.keys].sort, [$keys_p5(VAR %hash)].sort); |
|---|
| 42 | } |
|---|