Parrot::Test::Harness - a test harness for languages built on Parrot
Tell the harness which language, and optionally compiler or other executable, you want to use in a file called t/harness:
use Parrot::Test::Harness language => 'punie'; # or use Parrot::Test::Harness language => 'perl6', compiler => 'perl6.pbc'; # or use Parrot::Test::Harness language => 'eclectus', verbosity => 1, exec => [ 'petite', '--script' ], arguments => [ '--files' ], files => [ 't/*.pl' ];
That's it. Seriously.
This module provides a basic test harness for Parrot-hosted languages. Right now it parameterizes the three parameters that at least four language implementations need.
If you really want, you can pass a third option to the
arguments should be an array reference containing additional arguments (as you might find on the command line).
If you don't pass a
exec argument pair, the harness will run the tests with
perl. If you do pass one of these pairs, the harness can use another executable. For
exec a reference to a an array of string is expected. For
compiler the harness will run the tests with
parrot, calling the
compiler file as the first argument.
This means that you can write your tests in your language itself and run them through your compiler itself. If you can load PIR libraries from your language, you can even use the existing PIR testing tools.
verbosity argument pair is provided, it will pass it through to the TAP::Harness as is. This allows for extremely quiet or loud test output to be generated.
Written by chromatic with most of the intelligence stolen from the Punie harness and most of that probably stolen from Test::Harness
Please send patches and bug reports via Parrot's Trac queue or to the mailing list.
The option '--files' is used for supporting unified testing of language implementations. It is used by languages/t/harness for collecting a list testfiles from many language implementations.
When that option is passed, a list of pathes to test files is printed. Currently these test files need to be Perl 5 scripts. The file pathes are relative to a language implementation dir.
When the first argument in the '--files' list is '--master', add the language dir as a prefix to all files args.
When there is no '--files' option, then things are saner. Nothing is printed. An array of file pathes is returned to the caller.