diff Lib/IMPL/Test/Plan.pm @ 3:2e546a5175dd

in developing
author Sergey
date Tue, 11 Aug 2009 17:45:52 +0400
parents 03e58a454b20
children d59526f6310e
line wrap: on
line diff
--- a/Lib/IMPL/Test/Plan.pm	Mon Aug 10 17:39:08 2009 +0400
+++ b/Lib/IMPL/Test/Plan.pm	Tue Aug 11 17:45:52 2009 +0400
@@ -63,11 +63,14 @@
     foreach my $Unit ($this->Units){
         my %info;
         
+        # preload module
+        eval "require $Unit" unless (ref $Unit);
+        
         $info{Unit} = $Unit;
         try {
             $info{Tests} = [map $Unit->new($_), $Unit->List];
         } otherwise {
-            $info{Tests} = [$info{Unit} = new IMPL::Test::BadUnit($Unit->UnitName,"Failed to extract tests",$@)];
+            $info{Tests} = [$info{Unit} = new IMPL::Test::BadUnit($Unit->can('UnitName') ? $Unit->UnitName : $Unit,"Failed to extract tests",$@)];
         };
         $count += @{$info{Tests}};
         push @cache, \%info if @{$info{Tests}};