|parrotcode: Parrot extension for objecty testing of modules|
|Contents | Libraries|
Test::Class - Parrot extension for objecty testing of modules
.sub 'main' # load this library load_bytecode 'library/Test/Class.pbc' # load other testing libraries .include 'include/test_more.pir' .local pmc class class = subclass [ 'Test'; 'Class' ], 'MyClass' .local pmc obj obj = class.'new'() obj.'runtests'() .end .namespace [ 'MyClass' ] .sub 'init' :vtable :method self.'add_startup'( 'startup', 'tests' => 1 ) self.'add_shutdown'( 'shutdown', 'tests' => 1 ) self.'add_setup'( 'setup', 'tests' => 2 ) self.'add_teardown'( 'teardown', 'tests' => 1 ) self.'add_test'( 'test_foo', 'tests' => 3 ) self.'add_test'( 'test_bar', 'tests' => 2 ) .end
Test::Class is a pure-Parrot library for testing code in a class-y fashion. It allows you to group test code in methods and use other object oriented programming principles to organize and reuse code.
Most of your tests will occur within test methods;
Test::Class runs these automatically for you.
THIS INTERFACE MAY CHANGE IN THE NEAR FUTURE.
For each test method, you must call
add_test(), passing the name of the test method. You may optionally pass the named parameter
tests with the number of test assertions in the method. You may have as many test methods as you like.
Test::Class can also run methods at the start of the testing process and after all tests have ended. These are startup and shutdown tests, respectively. Call
add_shutdown() tests to add each type of test. Again, you may have as many of these methods as you like.
Test::Class can run setup and teardown methods before and after each individual test method. Call
When you have finished adding tests, call the
runtests() method to run everything.
Written and maintained by chromatic,
chromatic at wgz dot org, based on Test::Class in Perl 5, http://search.cpan.org/perldoc?Test::Class, written by Adrian Howard. Please send patches, feedback, and suggestions to the Perl 6 internals mailing list.
Copyright (C) 2008, The Perl Foundation.