It appears that simply putting a say, print, etc into a .t doesn’t work. The output is hidden. So when using Test::More and Test::Tester how can I simply print something? I want this so I can play with some code while determining how to test it. note: it’s ok if it’s sent to stderr or only viewable using verbose. Also I dried using diag but that didn’t appear to work just anywhere in the test.
It appears that simply putting a say , print , etc into a .t
Share
If you run a test script directly, you will see the output of
print— tests are just Perl code. However, if you run your tests using a harness, what you see in the output will be determined by the harness, especially its verbosity level, and by whether you print toSTDOUTorSTDERR.For another way to print messages within tests, see Diagnostics in the documentation for
Test::More, notably:Experimenting with a script like this will quickly illustrate how things work: