SPUG: redux: misunderstanding (or bug) with $Test::More::TODO

Michael R. Wolf MichaelRWolf at att.net
Mon Dec 29 14:29:25 PST 2008


Sorry, all.  In my attempt to keep my original posting short, I must  
have been too cryptic because I had already tried everything that got  
suggested.  (Thanks for the replies.  Sorry for misleading you).

Let me try again.

I cannot trigger the documented behavior of a TODO block within  
Test::More using ok().  To test this, I have created two files.   
Contrary to my understanding of the documentation (perldoc  
Test::More), I cannot get the two files to behave differently, either  
with perl(1) or prove(1).  Here is a complete listing of the files,  
and the output.

I get an "ok" on the second test, regardless of perl/prove or inside/ 
outside a TODO block.  (I *did* notice that the *comment* was  
different, but if it doesn't trigger a different *response* that's  
testable, so what?)

I get a 0 return code (indicating success) in all 4 runs (2 files * 2  
runs (1 each for perl(1) and prove(1)).  I was expecting that the  
"success" in a TODO would "report it as an unexpected success".  No  
dice.

Ideas?

Is TODO broken?

Has anyone really used TODO, and gotten the documented behavior?  (I'm  
seeming to remember a message from Schwern (a few years ago) that TODO  
doesn't really work.)

Thanks (and again, sorry for the too-short previous posting)
Michael

$ nl -ba t_m_trivial.t
      1	#! /usr/bin/perl
      2	
      3	use Test::More tests => 2;
      4	
      5	ok(1, 'normal true value 1');
      6	
      7	ok(2, 'normal true value 2');
$ nl -ba t_m_trivial_w_todo.t
      1	#! /usr/bin/perl
      2	
      3	use Test::More tests => 2;
      4	
      5	ok(1, 'normal true value 1');
      6	
      7	TODO: {
      8	    local $TODO = 'understand $Test::More::TODO';
      9	    ok(2, 'normal true value 2 inside a TODO block');
     10	}
$ perl t_m_trivial.t; echo $?
1..2
ok 1 - normal true value 1
ok 2 - normal true value 2
0
$ prove t_m_trivial.t; echo $?
t_m_trivial....ok
All tests successful.
Files=1, Tests=2,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.02 cusr   
0.00 csys =  0.05 CPU)
Result: PASS
0
$ perl t_m_trivial_w_todo.t; echo $?
1..2
ok 1 - normal true value 1
ok 2 - normal true value 2 inside a TODO block # TODO understand  
$Test::More::TODO
0
$ prove t_m_trivial_w_todo.t; echo $?
t_m_trivial_w_todo....ok
All tests successful.

Test Summary Report
-------------------
t_m_trivial_w_todo (Wstat: 0 Tests: 2 Failed: 0)
   TODO passed:   2
Files=1, Tests=2,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.02 cusr   
0.00 csys =  0.04 CPU)
Result: PASS
0
$ WTF?
bash: WTF?: command not found
$



Michael R. Wolf
     All mammals learn by playing!
         MichaelRWolf at att.net





More information about the spug-list mailing list