> On Sunday, October 6, 2002, at 07:06 pm, Kate L Pugh wrote: [snip] > I wanted a test that's like use_ok, but which fails if any warnings (such > as that below in [0]) come up during the 'use'. But I only wanted it > to fail once, however many warnings I got, and I wanted it to pass (as > opposed to not be run) if I got no warnings. This is what I did: [snip]
If you can live with two tests (one for the successful use, one for whether it caused warnings or not) you can use Test::Warn to produce something quite readable. For example: use strict; use Test::More tests => 2; use Test::Warn; BEGIN { warnings_are { use_ok('My::Module') } [], "My::Module raised no warnings"; }; Cheers, Adrian