NAME
Parrot::Test - Functions for testing Parrot and language implementations
SYNOPSIS
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
DESCRIPTION
This module provides various Parrot-specific test functions.
Functions
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.
output_is($code, $expected, $description)-
Runs the Parrot Assembler code and passes the test if a string comparison of the output with the expected result it true.
pasm_output_is($code, $expected, $description)-
Runs the Parrot Assembler code and passes the test if a string comparison of the output with the expected result it true.
output_like($code, $expected, $description)-
Runs the Parrot Assembler code and passes the test if the output matches the expected result.
pasm_output_like($code, $expected, $description)-
Runs the Parrot Assembler code and passes the test if the output matches the expected result.
output_isnt($code, $unexpected, $description)-
Runs the Parrot Assembler code and passes the test if a string comparison of the output with the unexpected result is false.
pasm_output_isnt($code, $unexpected, $description)-
Runs the Parrot Assembler code and passes the test if a string comparison of the output with the unexpected result is false.
pir_output_is($code, $expected, $description)-
Runs the PIR code and passes the test if a string comparison of output with the expected result it true.
pir_output_like($code, $expected, $description)-
Runs the PIR code and passes the test if output matches the expected result.
pir_output_isnt($code, $unexpected, $description)-
Runs the PIR code and passes the test if a string comparison of the output with the unexpected result is false.
pbc_output_is($code, $expected, $description)-
Runs the Parrot Bytecode and passes the test if a string comparison of output with the expected result it true.
pbc_output_like($code, $expected, $description)-
Runs the Parrot Bytecode and passes the test if output matches the expected result.
pbc_output_isnt($code, $unexpected, $description)-
Runs the Parrot Bytecode and passes the test if a string comparison of output with the unexpected result is false.
pir_2_pasm_is($code, $expected, $description)-
Compile the Parrot Intermediate Representation and generate Parrot Assembler Code.
pir_2_pasm_like($code, $expected, $description)-
Compile the Parrot Intermediate Representation and generate Parrot Assembler Code.
pir_2_pasm_isnt($code, $unexpected, $description)-
Compile the Parrot Intermediate Representation and generate Parrot Assembler Code.
c_output_is($code, $expected, $description)-
Compiles and runs the C code, passing the test if a string comparison of output with the expected result it true.
c_output_like($code, $expected, $description)-
Compiles and runs the C code, passing the test if output matches the expected result.
c_output_isnt($code, $unexpected, $description)-
Compiles and runs the C code, passing the test if a string comparison of output with the unexpected result is false.
skip($why, $how_many)-
Use within a
SKIP: { ... }block to indicate why and how many test are being skipped. Just like in Test::More.
SEE ALSO
- t/harness
- docs/tests.pod
- "More" in Test
- "Builder" in Test