Re: [Perlunit-devel] compile errors and Loader
Status: Beta
Brought to you by:
mca1001
From: Adam S. <ad...@sp...> - 2001-11-28 16:50:30
|
Adam Spiers (ad...@sp...) wrote: > I had the idea of creating a TestCase::_singleton class, so at > run-time the fragments could be blessed into a class which would > inherit from this, but then I realised that this would mean either > changing @MyTestCase::ISA dynamically, which is too awful to > contemplate, or ending up with the fragments not being blessed into > MyTestCase, which isn't nice either. Hmm, maybe they could be blessed > into MyTestCase::_singleton which ISA MyTestCase; that would be the > best of both worlds? I can't yet think of any applications of this yet other than it making things clearer when a PerlUnit developer inserts some debugging into the code like 'warn Dumper($suite);'. Even that small reason is worthwhile IMO though; it would have saved me a good few hours at one time ... In fact the following inheritance chain would be better: MyTestCase::_singleton ---> TestCase::_singleton \ --> MyTestCase --> TestCase so that you could then do tests like if (eval { $testcase->isa('TestCase::_singleton') }) { if you wanted. |