Is there a way to use diag () from Test :: More without planning?

I am writing several tests in Perl that have enough settings. In this setting, everything works in the module where the use test scripts are located. I want to be able to print some diagnostic data from the module and use the diag function from Test::More . The problem is that when you use Test::More , it writes a plan, so I get

You tried to schedule the program twice on the lib / MyTest.pm page.

Is it possible to use diag (or is there an equivalent), or am I sticking to print STDERR ?

+3
source share
2 answers

For me, the following code:

  #!/usr/bin/perl use strict; use Test::More; diag('hello'); 

Just prints

  # hello 

Test::More will not print the plan if you do not report it. This is done by passing args to its import:

  use Test::More tests => 30; 

Or by calling the plan directly.

  use Test::More; plan(tests => 30); 
+4
source
 use Test::More qw(no_plan) 
+4
source

All Articles