Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 751
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: drew [...] drewtaylor.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: feature request
I have a feature request. When I'm writing tests I've begun using diag() to help me along the way. It works great, but when I'm done writing the test I don't want the diagnostic info any more. Attached is a patch to implement this feature. To use it, just add "no_diag" to the import arguments when "use"ing the module. use Test::More tests=>1, qw(no_diag); diag("This is a diagnostic message"); ok(1, 'dummy test');
--- /usr/lib/perl5/site_perl/5.005/Test/More.pm Wed Mar 6 15:23:31 2002 +++ More.pm Mon Jun 17 11:47:32 2002 @@ -15,7 +15,6 @@ } - require Exporter; use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO); $VERSION = '0.42'; @@ -33,7 +32,7 @@ ); my $Test = Test::Builder->new; - +my $use_diag = 1; # 5.004's Exporter doesn't have export_to_level. sub _export_to_level @@ -172,12 +171,15 @@ sub plan { my(@plan) = @_; - my $caller = caller; $Test->exported_to($caller); $Test->plan(@plan); + if (grep(/no_diag/, @plan)) { + $use_diag = 0; + } + my @imports = (); foreach my $idx (0..$#plan) { if( $plan[$idx] eq 'import' ) { @@ -625,6 +627,7 @@ =cut sub diag { + return unless $use_diag; $Test->diag(@_); }
[guest - Mon Jun 17 11:50:25 2002]: Show quoted text
> I have a feature request. When I'm writing tests I've begun using > diag() to help me along the way. It works great, but when I'm done > writing the test I don't want the diagnostic info any more. > Attached is a patch to implement this feature. To use it, just add > "no_diag" to the import arguments when "use"ing the module. > > use Test::More tests=>1, qw(no_diag); > diag("This is a diagnostic message"); > ok(1, 'dummy test');
Alternatively, it could make diag() go to STDOUT. Hmmm.