From: Karen Etheridge Date: Sat, 14 Sep 2013 21:19:59 +0000 (-0700) Subject: remove needless use of Capture::Tiny X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Types-Common.git;a=commitdiff_plain;h=c44948b6d2754bb9add7499ba1773bc743178208 remove needless use of Capture::Tiny --- diff --git a/t/03-idiot.t b/t/03-idiot.t index 33b0939..c51c609 100644 --- a/t/03-idiot.t +++ b/t/03-idiot.t @@ -1,28 +1,24 @@ use strict; use warnings FATAL => 'all'; -use Test::More; +use Test::More tests => 2; +use Test::Warnings ':no_end_test', ':all'; +use Test::Deep; # Test for a warning when you make the stupid mistake I make all the time # of saying use MooseX::Types::Common qw/NonEmptySimpleStr/; -BEGIN { - eval { require Capture::Tiny } - or plan skip_all => 'Capture::Tiny needed for these tests'; -} +require MooseX::Types::Common; -plan tests => 4; +cmp_deeply( + [ warnings { MooseX::Types::Common->import } ], + [], + 'No warning if nothing imported', +); -use_ok 'MooseX::Types::Common'; - -my ($stdout, $stderr) = Capture::Tiny::capture(sub { - MooseX::Types::Common->import; -}); -is $stderr, '', 'No warning if nothing imported'; - -($stdout, $stderr) = Capture::Tiny::capture(sub { - MooseX::Types::Common->import('NonEmptySimpleStr'); -}); -like $stderr, qr/Did you mean/, 'Got warning'; -like $stderr, qr/NonEmptySimpleStr/, 'Warning mentions bad type'; +cmp_deeply( + [ warnings { MooseX::Types::Common->import('NonEmptySimpleStr') } ], + [ re(qr/Did you mean.*NonEmptySimpleStr/s) ], + 'Warning mentions bad type', +);