Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Tue, Jan 29, 2002 at 01:38:12AM -0500, Dan Sugalski wrote: At 9:33 PM -0800 1/28/02, Steve Fink wrote: On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* Hmmm. Make clean, resync, and try again? It's failing to fail for me, and I'm up to date. Must be something local. I have two checkouts, one with a bunch of local changes and the other completely clean. They both do the same thing. Could it be finding a local version of a Test::SomethingOrOther module? I'll dig into it when I get a chance today.
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Tue, Jan 29, 2002 at 10:10:56AM -0800, Steve Fink wrote: On Tue, Jan 29, 2002 at 01:38:12AM -0500, Dan Sugalski wrote: At 9:33 PM -0800 1/28/02, Steve Fink wrote: On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* Hmmm. Make clean, resync, and try again? It's failing to fail for me, and I'm up to date. Must be something local. I have two checkouts, one with a bunch of local changes and the other completely clean. They both do the same thing. Could it be finding a local version of a Test::SomethingOrOther module? Yep, that was it. perl -I. t/op/macro.t works. It's because I have older versions of Test::* modules earlier in @INC. This would paper over the 'make test' failure: Index: Makefile.in === RCS file: /home/perlcvs/parrot/Makefile.in,v retrieving revision 1.124 diff -p -u -b -r1.124 Makefile.in --- Makefile.in 29 Jan 2002 21:38:18 - 1.124 +++ Makefile.in 29 Jan 2002 23:15:12 - @@ -103,7 +103,7 @@ C_LIBS = ${libs} CC = ${cc} LD = ${ld} -PERL = ${perl} +PERL = ${perl} -I. ###
Re: *poke* *poke* Parrot::Test - Test::Builder patch
At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. --- /dev/null Mon Jan 28 02:17:54 2002 +++ Test/Builder.pm Sat Jan 12 17:05:41 2002 @@ -0,0 +1,1189 @@ +package Test::Builder; + +use 5.004; + +# $^C was only introduced in 5.005-ish. We do this to prevent +# use of uninitialized value warnings in older perls. +$^C ||= 0; + +use strict; +use vars qw($VERSION $CLASS); +$VERSION = '0.11'; +$CLASS = __PACKAGE__; + +my $IsVMS = $^O eq 'VMS'; + +use vars qw($Level); +my @Test_Results = (); +my @Test_Details = (); +my($Test_Died) = 0; +my($Have_Plan) = 0; +my $Curr_Test = 0; + + +=head1 NAME + +Test::Builder - Backend for building test libraries + +=head1 SYNOPSIS + + package My::Test::Module; + use Test::Builder; + require Exporter; + @ISA = qw(Exporter); + @EXPORT = qw(ok); + + my $Test = Test::Builder-new; + $Test-output('my_logfile'); + + sub import { + my($self) = shift; + my $pack = caller; + + $Test-exported_to($pack); + $Test-plan(@_); + + $self-export_to_level(1, $self, 'ok'); + } + + sub ok { + my($test, $name) = @_; + + $Test-ok($test, $name); + } + + +=head1 DESCRIPTION + +ITHIS IS ALPHA GRADE SOFTWARE Meaning the underlying code is well +tested, yet the interface is subject to change. + +Test::Simple and Test::More have proven to be popular testing modules, +but they're not always flexible enough. Test::Builder provides the a +building block upon which to write your own test libraries Iwhich can +work together. + +=head2 Construction + +=over 4 + +=item Bnew + + my $Test = Test::Builder-new; + +Returns a Test::Builder object representing the current state of the +test. + +Since you only run one test per program, there is Bone and only one +Test::Builder object. No matter how many times you call new(), you're +getting the same object. (This is called a singleton). + +=cut + +my $Test; +sub new { +my($class) = shift; +$Test ||= bless ['Move along, nothing to see here'], $class; +return $Test; +} + +=back + +=head2 Setting up tests + +These methods are for setting up tests and declaring how many there +are. You usually only want to call one of these methods. + +=over 4 + +=item Bexported_to + + my $pack = $Test-exported_to; + $Test-exported_to($pack); + +Tells Test::Builder what package you exported your functions to. +This is important for getting TODO tests right. + +=cut + +my $Exported_To; +sub exported_to { +my($self, $pack) = @_; + +if( defined $pack ) { +$Exported_To = $pack; +} +return $Exported_To; +} + +=item Bplan + + $Test-plan('no_plan'); + $Test-plan( skip_all = $reason ); + $Test-plan( tests = $num_tests ); + +A convenient way to set up your tests. Call this and Test::Builder +will print the appropriate headers and take the appropriate actions. + +If you call plan(), don't call any of the other methods below. + +=cut + +sub plan { +my($self, $cmd, $arg) = @_; + +return unless $cmd; + +if( $cmd eq 'no_plan' ) { +$self-no_plan; +} +elsif( $cmd eq 'skip_all' ) { +return $self-skip_all($arg); +} +elsif( $cmd eq 'tests' ) { +if( $arg ) { +return $self-expected_tests($arg); +} +elsif( !defined $arg ) { +die Got an undefined number of tests. Looks like you tried to . +say how many tests you plan to run but made a mistake.\n; +} +elsif( !$arg ) { +die You said to run 0 tests! You've got to run something.\n; +} +} +} + +=item Bexpected_tests + +my $max = $Test-expected_tests; +$Test-expected_tests($max); + +Gets/sets the # of tests we expect this test to run and prints out +the appropriate headers. + +=cut + +my $Expected_Tests = 0; +sub expected_tests { +my($self, $max) = @_; + +if( defined $max ) { +$Expected_Tests = $max; +$Have_Plan = 1; + +$self-_print(1..$max\n) unless $self-no_header; +} +return $Expected_Tests; +} + + +=item Bno_plan + + $Test-no_plan; + +Declares that this test will run an indeterminate # of tests. + +=cut + +my($No_Plan) = 0; +sub no_plan { +$No_Plan= 1; +$Have_Plan = 1; +} + +=item Bskip_all + + $Test-skip_all; + $Test-skip_all($reason); + +Skips all the tests, using the given $reason. Exits immediately with 0. + +=cut + +my $Skip_All = 0; +sub skip_all { +my($self, $reason) = @_; + +my $out = 1..0; +$out .= # Skip $reason if $reason; +$out .= \n; + +$Skip_All = 1; + +$self-_print($out) unless $self-no_header; +exit(0); +} + +=back + +=head2 Running tests + +These actually run the tests, analogous
Re: *poke* *poke* Parrot::Test - Test::Builder patch
At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. Thanks. Simon mentioned something about Parrot::Test not reporting segfaults and weird exit codes well? -- Michael G. Schwern [EMAIL PROTECTED]http://www.pobox.com/~schwern/ Perl Quality Assurance [EMAIL PROTECTED] Kwalitee Is Job One Right Wing Enema: Flush Immorality Now! God gums gay gorgings. -- boojum
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* From the commit log: Parrot::Test no longer exports Test::More's functions. Instead they can simply be used together. The few tests which used Test::More features (ie. skip) have 'use Test::More' added. No they can't (be used together): % perl t/op/stacks.t 1..15 ok 1 - pushi popi ok 2 - pushs pops ok 3 - pushn popn ok 4 - pushp popp ok 5 - save_i restore_i ok 6 - ENO I frames ok 7 - ENO N frames ok 8 - ENO S frames ok 9 - rotate 0 ok 10 - rotate 1 ok 11 - rotate 2 ok 12 - rotate 3 ok 13 - save, restore ok 14 - entrytype You tried to use ok() without a plan! Gotta have a plan. use Test::Simple tests = 23; for example. # Looks like you planned 15 tests but only ran 14. If I do use Parrot::Test tests = 15; - use Test::More; + use Test::More tests = 15; then they fight over the tests. 1..15 1..15 ok 1 - pushi popi ok 2 - pushs pops ok 3 - pushn popn ok 4 - pushp popp ok 5 - save_i restore_i ok 6 - ENO I frames ok 7 - ENO N frames ok 8 - ENO S frames ok 9 - rotate 0 ok 10 - rotate 1 ok 11 - rotate 2 ok 12 - rotate 3 ok 13 - save, restore ok 14 - entrytype ok 1 # skip Await exceptions # Looks like you planned 15 tests but only ran 1. # Looks like you planned 15 tests but only ran 14.
Re: *poke* *poke* Parrot::Test - Test::Builder patch
At 9:33 PM -0800 1/28/02, Steve Fink wrote: On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* From the commit log: Parrot::Test no longer exports Test::More's functions. Instead they can simply be used together. The few tests which used Test::More features (ie. skip) have 'use Test::More' added. No they can't (be used together): % perl t/op/stacks.t Dammit, I had that working before I committed things. I'll fix. -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Mon, Jan 28, 2002 at 09:33:06PM -0800, Steve Fink wrote: On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* From the commit log: Parrot::Test no longer exports Test::More's functions. Instead they can simply be used together. The few tests which used Test::More features (ie. skip) have 'use Test::More' added. Is there something wrong with rsync cvs.perl.org::parrot-HEAD? It doesn't seem to keep up to date. -- Michael G. Schwern [EMAIL PROTECTED]http://www.pobox.com/~schwern/ Perl Quality Assurance [EMAIL PROTECTED] Kwalitee Is Job One It's Airplane Glue sniffing time!
Re: *poke* *poke* Parrot::Test - Test::Builder patch
On Tue, Jan 29, 2002 at 12:39:36AM -0500, Dan Sugalski wrote: Dammit, I had that working before I committed things. I'll fix. Looks like things drifted a bit since I wrote the patch. Want me to do it over? -- Michael G. Schwern [EMAIL PROTECTED]http://www.pobox.com/~schwern/ Perl Quality Assurance [EMAIL PROTECTED] Kwalitee Is Job One I need a SHOWER a BURGER and some ROBOTS, STAT! -- http://www.angryflower.com/allrigh.gif
Re: *poke* *poke* Parrot::Test - Test::Builder patch
At 12:49 AM -0500 1/29/02, Michael G Schwern wrote: On Tue, Jan 29, 2002 at 12:39:36AM -0500, Dan Sugalski wrote: Dammit, I had that working before I committed things. I'll fix. Looks like things drifted a bit since I wrote the patch. Want me to do it over? If you can find where I messed up, please do. I think I need a Writing Tests for Dummies (or gibbering idiots, or something) -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk
Re: *poke* *poke* Parrot::Test - Test::Builder patch
At 9:33 PM -0800 1/28/02, Steve Fink wrote: On Mon, Jan 28, 2002 at 09:36:19PM -0500, Dan Sugalski wrote: At 7:47 PM -0500 1/28/02, Michael G Schwern wrote: On Mon, Jan 28, 2002 at 04:07:06PM -0500, Dan Sugalski wrote: At 1:55 AM -0500 1/28/02, Michael G Schwern wrote: This patch seems to have slipped by in the post New Year's haze. It updates Parrot's version of Test::More to 0.41 and makes Parrot::Test use Test::Builder instead of doing Evil things to Test::More. Where's Test/Builder.pm, though? Hells bells. Here it is. And the patch is in. Thanks. *kaboom* Hmmm. Make clean, resync, and try again? It's failing to fail for me, and I'm up to date. -- Dan --it's like this--- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk