use v6; use Test; plan(5); unless eval 'eval("1", :lang)' { skip_rest; exit; } eval(q/ package Id; sub new { my ($class, $ref) = @_; bless \$ref, $class; } sub identity { my $self = shift; return $$self; } /, :lang); my $japh = { "Just another $_ hacker" }; my $japh2 = -> $name { "Just another $name hacker" }; my $id = eval('sub { Id->new($_[0]) }', :lang); is($id($japh).identity.('Pugs'), 'Just another Pugs hacker', "Closure roundtrips"); is($id($japh2).identity.('Pugs'), 'Just another Pugs hacker', "Closure roundtrips"); my $keys_p5 = eval('sub {keys %{$_[0]}}', :lang); my $tohash_p5 = eval('sub { return {map {$_ => 1} @_ } }', :lang); my %hash = (foo => 'bar', hate => 'software'); { my $foo = $tohash_p5.(keys %hash); cmp_ok($foo, &infix:, %hash); is_deeply([$foo.keys].sort, [%hash.keys].sort); } { is_deeply([%hash.keys].sort, [$keys_p5(VAR %hash)].sort); }