Skip to content
Browse files

* plan( add => # ) now allows you to add to the plan as you go.

plan() needs refactoring and the tests suck
  • Loading branch information...
1 parent 95bcdbe commit 649cc65b33953136dc4be2a7e9ea77b6891daeab @schwern schwern committed Feb 13, 2009
Showing with 29 additions and 19 deletions.
  1. +1 −0 Changes
  2. +17 −16 MANIFEST
  3. +11 −3 lib/Test/Builder.pm
View
1 Changes
@@ -3,6 +3,7 @@
* done_testing() allows you to declare that you have finished running tests,
and how many you ran. It is a safer no_plan and effectively replaces it.
* output() now supports scalar references.
+ * plan( add => # ) now allows you to add to the plan as you go.
Feature Changes
* You can now run a test without first declaring a plan. This allows
View
33 MANIFEST
@@ -1,11 +1,6 @@
.perlcriticrc
.perltidyrc
Changes
-MANIFEST This list of files
-MANIFEST.SKIP
-Makefile.PL
-README
-TODO
lib/Test/Builder.pm
lib/Test/Builder/IO/Scalar.pm
lib/Test/Builder/Module.pm
@@ -14,9 +9,16 @@ lib/Test/Builder/Tester/Color.pm
lib/Test/More.pm
lib/Test/Simple.pm
lib/Test/Tutorial.pod
+Makefile.PL
+MANIFEST This list of files
+MANIFEST.SKIP
+README
t/00test_harness_check.t
+t/bad_plan.t
+t/bail_out.t
t/BEGIN_require_ok.t
t/BEGIN_use_ok.t
+t/buffer.t
t/Builder/Builder.t
t/Builder/carp.t
t/Builder/create.t
@@ -41,17 +43,6 @@ t/Builder/output.t
t/Builder/reset.t
t/Builder/reset_outputs.t
t/Builder/try.t
-t/More.t
-t/Tester/tbt_01basic.t
-t/Tester/tbt_02fhrestore.t
-t/Tester/tbt_03die.t
-t/Tester/tbt_04line_num.t
-t/Tester/tbt_05faildiag.t
-t/Tester/tbt_06errormess.t
-t/Tester/tbt_07args.t
-t/bad_plan.t
-t/bail_out.t
-t/buffer.t
t/c_flag.t
t/circular_data.t
t/cmp_ok.t
@@ -96,13 +87,15 @@ t/lib/Test/Simple/sample_tests/too_few_fail.plx
t/lib/Test/Simple/sample_tests/two_fail.plx
t/lib/TieOut.pm
t/missing.t
+t/More.t
t/new_ok.t
t/no_plan.t
t/no_tests.t
t/note.t
t/overload.t
t/overload_threads.t
t/plan.t
+t/plan_add.t
t/plan_bad.t
t/plan_is_noplan.t
t/plan_no_plan.t
@@ -115,10 +108,18 @@ t/simple.t
t/skip.t
t/skipall.t
t/tbm_doesnt_set_exported_to.t
+t/Tester/tbt_01basic.t
+t/Tester/tbt_02fhrestore.t
+t/Tester/tbt_03die.t
+t/Tester/tbt_04line_num.t
+t/Tester/tbt_05faildiag.t
+t/Tester/tbt_06errormess.t
+t/Tester/tbt_07args.t
t/thread_taint.t
t/threads.t
t/todo.t
t/undef.t
t/use_ok.t
t/useing.t
t/utf8.t
+TODO
View
14 lib/Test/Builder.pm
@@ -222,17 +222,20 @@ sub plan {
local $Level = $Level + 1;
- $self->croak("You tried to plan twice")
- if $self->{Have_Plan};
-
if( $cmd eq 'no_plan' ) {
+ $self->croak("You tried to plan twice") if $self->{Have_Plan};
+
$self->carp("no_plan takes no arguments") if $arg;
$self->no_plan;
}
elsif( $cmd eq 'skip_all' ) {
+ $self->croak("You tried to plan twice") if $self->{Have_Plan};
+
return $self->skip_all($arg);
}
elsif( $cmd eq 'tests' ) {
+ $self->croak("You tried to plan twice") if $self->{Have_Plan};
+
if($arg) {
local $Level = $Level + 1;
return $self->expected_tests($arg);
@@ -244,6 +247,11 @@ sub plan {
$self->croak("You said to run 0 tests");
}
}
+ elsif( $cmd eq 'add' ) {
+ $self->{Expected_Tests} = $self->{Expected_Tests} + $arg;
+ $self->{Have_Plan} = 1;
+ $self->no_plan;
+ }
else {
my @args = grep { defined } ( $cmd, $arg );
$self->croak("plan() doesn't understand @args");

0 comments on commit 649cc65

Please sign in to comment.
Something went wrong with that request. Please try again.