-
-
Save zoffixznet/92317fbdfec783ea8a6187bb38bdc4b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Test; | |
plan 1; | |
subtest '.say method' => { | |
plan 5*5; | |
my $file = make-temp-file; | |
sub test-output (Capture \in, Str:D \out, Str :$nl-out) { | |
$file.open(:w).close; # clear file | |
with $nl-out { | |
with $file.open(:w, :$nl-out) { .say: |in; .close } | |
is-deeply $file.slurp, out ~ $nl-out, | |
in.perl ~ ' :nl-out(' ~ $nl-out.perl ~ ')'; | |
} | |
else { | |
with $file.open(:w) { .say: |in; .close } | |
is-deeply $file.slurp, out, in.perl; | |
} | |
} | |
for Str, '', 'foos', '♥', "\n" -> $nl-out { | |
test-output :$nl-out, \( ), ""; | |
test-output :$nl-out, \('foo' ), "foo"; | |
test-output :$nl-out, \(<a b c>), "(a b c)"; | |
test-output :$nl-out, \(1, 2, 3), "(a b c)"; | |
test-output :$nl-out, \( | |
(Mu, my class Foo42 {}, my class { method gist { 'I ♥ Perl 6' } }, | |
1, 2, [3, 5, ('foos',).Seq], %(<meow bar>), :42bar.Pair) | |
}, '((Mu) (Foo) I ♥ Perl 6 1 2 [3 5 (foos)] {meow => bar} bar => 42)'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment