You can run Perl 6 tests with prove
. Forget for a moment that prove
is a Perl 5 tool. It’s just some tool that’s magically on your system. It’s a Test Anywhere Protocol consumer so anything that outputs TAP is fine with it.
I can tell the tool which program to use when it executes the test files by specifying it with --exec
:
prove --exec perl6 some_test_file.t6
A P6 test file looks much like the old Test::More stuff that you already know. However, since we’ve started fresh, it’s just Test:
use v6; use Test; subtest 'is' => { is( "4", 4, "How do the Str and Int do?" ); is( <4>, 4, "How do the IntStr and Int do?" ); } subtest 'isa' => { isa-ok( <4>, IntStr ); isa-ok( <4>, Int ); isa-ok( <4>, Str ); isa-ok( <4>, Rat ); # !!! } done-testing;
102% woohoo!
FYI, superstitious parens on the is calls.
perl6 -e ‘use Test; is “4”, 4, “nope”‘;
Once you’ve switched permanently to Perl 6:
echo –exec perl6 >> ~/.proverc