Thread: [Perlunit-users] The First Steps Or A Trap On The Way
Status: Beta
Brought to you by:
mca1001
From: Oliver F. <pl...@sn...> - 2002-02-21 21:05:31
|
At first: Thanks for bringing Beck's test framework to Perl! Today I wrote my first test cases and stepped in a possible trap. I startet my test classs by following the example provided in TestCase.pm package FooBar; use base qw(Test::Unit::TestCase); sub new { my $self = shift()->SUPER::new(@_); # your state for fixture here return $self; } Unfortunately this code caused only errors on my system (w2k and AS Perl). So I changed the code. This is working... package CVSWrapper::punit::CommandOptionPT; use Test::Unit::TestCase; @ISA = qw'Test::Unit::TestCase'; sub new { my $type = shift; my $self = new Test::Unit::TestCase(@_); bless $self, $type; return $self; } Is the documentation wrong or what is the reason? Thanks and bye... Oliver -- Oliver Fischer - mailto:pl...@sn... |
From: Adam S. <ad...@sp...> - 2002-02-23 23:39:23
|
Oliver Fischer (pl...@sn...) wrote: > At first: Thanks for bringing Beck's test framework to Perl! > > Today I wrote my first test cases and stepped in a possible trap. I startet > my test classs by following the example provided in TestCase.pm > > package FooBar; > > use base qw(Test::Unit::TestCase); > > sub new { > my $self = shift()->SUPER::new(@_); > # your state for fixture here > return $self; > } > > Unfortunately this code caused only errors on my system (w2k and AS Perl). I can't be sure because you didn't include the errors in your mail, but it sounds like you're probably suffering from the buggy base.pm which comes with older versions (e.g. 5.005 IIRC) of Perl. For this reason the CVS tree includes a dependency on at least version 1.00 of base.pm. |
From: Oliver F. <pl...@sn...> - 2002-02-24 09:42:09
|
Hi, > I can't be sure because you didn't include the errors in your mail, > but it sounds like you're probably suffering from the buggy base.pm > which comes with older versions (e.g. 5.005 IIRC) of Perl. For this > reason the CVS tree includes a dependency on at least version 1.00 of > base.pm. yes, you are right, I should have done this. Ok, here they are: C:\devel\CVSWrapper\src>perl -I./ c:\perl\site\lib\Test\TestRunner.pl CVSWrapper ::punit::CommandOptionPT .F.F.F.F Time: 0 wallclock secs ( 0.00 usr + 0.01 sys = 0.01 CPU) !!!FAILURES!!! Test Results: Run: 4 Failures: 4 Errors: 0 There were 4 failures: 1) (CVSWrapper::punit::CommandOptionPT) Test::Unit::ExceptionFailure: Method not found Level 1: in package 'Test::Unit::TestCase', file 'C:/Perl/site/lib/Test/Unit/TestCase.pm', at line '69', sub 'Test::Unit::Assert::fail' Level 2: in package 'Test::Unit::TestCase', file 'C:/Perl/site/lib/Test/Unit/TestCase.pm', at line '48', sub 'Test::Unit::TestCase::run_test' Level 3: in package 'Test::Unit::TestCase', file 'C:/Perl/site/lib/Test/Unit/TestCase.pm', at line '47', sub '(eval)' Level 4: in package 'Test::Unit::TestResult', file 'C:/Perl/site/lib/Test/Unit/TestResult.pm', at line '99', sub 'Test::Unit::TestCase::run_bare' Level 5: in package 'Test::Unit::TestResult', file 'C:/Perl/site/lib/Test/Unit/TestResult.pm', at line '109', sub 'Test::Unit::TestResult::__ANON__' Level 6: in package 'Test::Unit::TestResult', file 'C:/Perl/site/lib/Test/Unit/TestResult.pm', at line '108', sub '(eval)' Level 7: in package 'Test::Unit::TestResult', file 'C:/Perl/site/lib/Test/Unit/TestResult.pm', at line '99', sub 'Test::Unit::TestResult::run_protected' Level 8: in package 'Test::Unit::TestCase', file 'C:/Perl/site/lib/Test/Unit/TestCase.pm', at line '39', sub 'Test::Unit::TestResult::run' Level 9: in package 'Test::Unit::TestSuite', file 'C:/Perl/site/lib/Test/Unit/TestSuite.pm', at line '118', sub 'Test::Unit::TestCase::run' Level 10: in package 'Test::Unit::TestRunner', file 'C:/Perl/site/lib/Test/Unit/ TestRunner.pm', at line '58', sub 'Test::Unit::TestSuite::run' Level 11: in package 'Test::Unit::TestRunner', file 'C:/Perl/site/lib/Test/Unit/ TestRunner.pm', at line '196', sub 'Test::Unit::TestRunner::do_run' Level 12: in package 'main', file 'c:\perl\site\lib\Test\TestRunner.pl', at line '4', sub 'Test::Unit::TestRunner::start' - I run this version of perl: C:\>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 631 provided by ActiveState Tool Corp. http://www.ActiveState.com Built 17:16:22 Jan 2 2002 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. - Test::Unit was installed via the active state package manger. - base.pm has version 1.01 Hope that helps... Nice Sunday..... Oliver |
From: Adam S. <ad...@sp...> - 2002-02-24 11:45:59
|
Oliver Fischer (pl...@sn...) wrote: > - I run this version of perl: > > C:\>perl -v > > This is perl, v5.6.1 built for MSWin32-x86-multi-thread > (with 1 registered patch, see perl -V for more detail) > > Copyright 1987-2001, Larry Wall > > Binary build 631 provided by ActiveState Tool Corp. > http://www.ActiveState.com > Built 17:16:22 Jan 2 2002 > > - Test::Unit was installed via the active state package manger. > > - base.pm has version 1.01 > > Hope that helps... Hmm, it's not what I thought then. The best advice I can give is to checkout the CVS version from sourceforge and try that, because there have been countless improvements and bugfixes since the last release. Piers, any thoughts on a release date, and the outstanding stuff in doc/TODO? |