[Perlunit-devel] more TestSuite/API issues
Status: Beta
Brought to you by:
mca1001
From: Adam S. <ad...@sp...> - 2001-11-28 18:59:25
|
Ah, I think I broke something (else). TestSuite used to read: sub new { [snip] return $classname->suite if eval {$classname->can('suite')}; [snip] =head1 SYNOPSIS [snip] # get and add an existing suite $suite->add_test(Test::Unit::TestSuite->new("MyModule::Suite_1")); Hmm. I'm fixing that. While I'm at it, I intend to support $suite->add_test('MySuite'); and $suite->add_test('MyTestCase'); which are much more convenient to write and easier to read. This will allow the simplest way of building suites yet, which I've been hankering after for a while now: package MySuite; use base 'Test::Case::TestSuite'; sub subtests { qw(MySuite2 MyTestCase) } sub name { 'foo' } It makes sense to use Test::Unit::Loader to do the work of ensuring that the correct stuff gets compiled (MySuite2 and MyTestCase in the example immediately above), so I've been looking at Test::Unit::Loader. It has some code which puzzles me, e.g. if ($test_case->can("suite")) { print "$test_case has a suite() method\n" if DEBUG; return $test_case->suite(); } Surely no test case will have a suite() method? Only test suites have a suite() method. Also, the pod claims that the module handles testcase class names, Test::Harness style test files, and directory names, but makes no mention of handling test suites, even though it does handle test suites for the benefit of TestRunner and HarnessUnit. I'll try to address all this now. |