| parrotcode: testing routines for Parrot and language implementations | |
| Contents | Perl Modules |

Parrot::Test - testing routines for Parrot and language implementations

Set the number of tests to be run like this:
use Parrot::Test tests => 8;
Write individual tests like this:
pasm_output_is(<<'CODE', <<'OUTPUT', "description of test");
print "this is ok\n"
end
CODE
this is ok
OUTPUT

This module provides various Parrot-specific test functions.

The parameter $language is the language of the code. The parameter $code is the code that should be executed or transformed. The parameter $expected is the expected result. The parameter $unexpected is the unexpected result. The parameter $description should describe the test.
Any optional parameters can follow. For example, to mark a test as a TODO test (where you know the implementation does not yet work), pass:
todo => 'reason to consider this TODO'
at the end of the argument list. Valid reasons include bug, unimplemented, and so on.
Note: you must use a $description with TODO tests.
language_output_is( $language, $code, $expected, $description)language_error_output_is( $language, $code, $expected, $description)language_error_output_is() the exit code also has to be non-zero.language_output_like( $language, $code, $expected, $description)language_error_output_like( $language, $code, $expected, $description)language_error_output_like() the exit code also has to be non-zero.language_output_isnt( $language, $code, $expected, $description)language_error_output_isnt( $language, $code, $expected, $description)language_error_output_isnt() the exit code also has to be non-zero.pasm_output_is($code, $expected, $description)pasm_error_output_is($code, $expected, $description)pasm_output_like($code, $expected, $description)$expected.pasm_error_output_like($code, $expected, $description)$expected and if Parrot exits with a non-zero exit code.pasm_output_isnt($code, $unexpected, $description)pasm_error_output_isnt($code, $unexpected, $description)pir_output_is($code, $expected, $description)pir_error_output_is($code, $expected, $description)pir_output_like($code, $expected, $description)pir_error_output_like($code, $expected, $description)pir_output_isnt($code, $unexpected, $description)pir_error_output_isnt($code, $unexpected, $description)pbc_output_is($code, $expected, $description)pbc_error_output_is($code, $expected, $description)pbc_output_like($code, $expected, $description)pbc_error_output_like($code, $expected, $description)pbc_output_isnt($code, $unexpected, $description)pbc_error_output_isnt($code, $unexpected, $description)pir_2_pasm_is($code, $expected, $description)pir_2_pasm_like($code, $expected, $description)pir_2_pasm_isnt($code, $unexpected, $description)c_output_is($code, $expected, $description, %options)c_output_like($code, $expected, $description, %options)c_output_isnt($code, $unexpected, $description, %options)example_output_is( $example_f, $expected, @todo )example_output_like( $example_f, $expected, @todo )example_output_isnt( $example_f, $expected, @todo )$example_f and runs the appropriate ^language_output_(is|kike|isnt) sub. $example_f is used as a description, so don't pass one.skip($why, $how_many)SKIP: { ... } block to indicate why and how many tests to skip, just like in Test::More.run_command($command, %options) STDOUT filehandle to redirect STDOUT to
STDERR filehandle to redirect STDERR to
CD directory to run the command in
# equivalent to "cd some_dir && make test"
run_command("make test", CD => "some_dir");
slurp_file($file_name)convert_line_endings($text)path_to_parrot()per_test( $ext, $test_no )$0 into account.write_code_to_file($code, $code_f)$code into the file $code_f.generate_languages_functions
|
|
|