parrotcode: Parrot extension for testing test modules | |
Contents | Libraries |
Test::Builder::Tester - Parrot extension for testing test modules
# load this library
load_bytecode 'library/Test/Builder/Tester.pbc'
# grab the subroutines you want to use
.local pmc plan
.local pmc test_out
.local pmc test_diag
.local pmc test_test
plan = find_global [ 'Test'; 'Builder'; 'Tester' ], 'plan'
test_out = find_global [ 'Test'; 'Builder'; 'Tester' ], 'test_out'
test_diag = find_global [ 'Test'; 'Builder'; 'Tester' ], 'test_diag'
test_test = find_global [ 'Test'; 'Builder'; 'Tester' ], 'test_test'
# create a new Test::Builder object
.local pmc tb_args
.local pmc test
tb_args = new 'Hash'
test = new [ 'Test'; 'Builder' ], tb_args
# set your test plan
plan( 4 )
# test a passing test
test_out( 'ok 1 - hi' )
test.'ok'( 1, 'hi' )
test_test( 'passing test')
# test a test with some diagnostics
test_out( 'ok 3 - A message' )
test_diag( "some\nlines" )
test.ok( 1, 'A message' )
test.diag( 'some' )
test.diag( 'lines' )
test_test( 'passing test with diagnostics' )
# clean up
test.'finish'()
Test::Builder::Tester is a pure-Parrot library for testing testing modules built on Test::Builder. It allows you to describe the TAP output that they will produce, showing any differences in description, directive, and diagnostics.
This is a procedural library.
This module defines the following public functions:
plan( num_tests )
num_tests
is an int.test_pass( test_string )
test_string
is the optional description of the test.test_fail( test_string )
test_string
is the optional description of the test.test_out( test_string )
test_err( test_string )
test_diag( test_string )
test_err()
are effectively the same.test_test( test_description )
Written and maintained by chromatic, chromatic at wgz dot org
, based on the Perl 6 port he wrote, based on the original Perl 5 version written by Mark Fowler. Please send patches, feedback, and suggestions to the Perl 6 internals mailing list.
Copyright (C) 2005-2008, The Perl Foundation.
|