Test::Class helpfully has a shortcut to allow you to run the tests from
multiple classes as if they were one test:

  If you want to run multiple test objects in a single script you
  can pass "runtests" a list of test objects ... Since you can pass
  "runtests" class names instead of objects the above can be written
  more compactly as:
          Test::Class->runtests(qw( Example::Test Another::Test ))

However, Test::Class doesn't like it if you haven't "use"d the modules
first, necessitating your test script repeating the classnames:

  use Example::Test;
  use Another::Test;

  Test::Class->runtests(qw( Example::Test Another::Test ))

I hate this sort of duplication, so I tried for a while to eliminate it,
mostly through an approach like:

        use Test::Class;
        use UNIVERSAL::require;

  my @tests = qw( Example::Test Another::Test );
  foreach my $class (@tests) {
    $class->require or die "Can't require $class";
  }
  Test::Class->runtests(@tests);

However this keeps dying with "cannot test anonymous subs". A
cursory delve into the innards of Test::Class implies that perhaps
Attribute::Handlers is getting confused somewhere. But I'm not sure
what's going on here really ...

Anyone shed any light?

Tony

Reply via email to