The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!perl
use Test::Script 1.23;
my $expected = <<EOF;
const A = 100;
const B = 200;
EOF
script_runs(
[qw( bin/js-const -I t/lib -m Consts2 )],
{
exit => 0,
stdout => \my $out
}
);
is $out, $expected, 'expected output (stoud)';
my $file = Path::Tiny->tempfile;
script_runs(
[qw( bin/js-const -I t/lib -m Consts2 ), "$file" ],
{
exit => 0,
}
);
is $file->slurp, $expected, "wrote to file";
done_testing;