X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fwhen.t;h=fd0ccdec89dd8648452d5507bce14f986ce666b8;hb=8c34b0efb19410754cf5983c951dbc59d6df0774;hp=e6d64e6372d5b72108db7cb0b30f50482c4bd40a;hpb=ae53da51cdb8704e63bfbc6e13ccbb0816a2fa62;p=p5sagit%2FTry-Tiny.git diff --git a/t/when.t b/t/when.t index e6d64e6..fd0ccde 100644 --- a/t/when.t +++ b/t/when.t @@ -1,33 +1,31 @@ -#!/usr/bin/perl - use strict; -#use warnings; +use warnings; use Test::More; BEGIN { - plan skip_all => "Perl 5.10 required" unless eval { require 5.010; 1 }; - plan tests => 6; + plan skip_all => 'Perl 5.010 is required' unless "$]" >= '5.010'; + plan tests => 5; } - -BEGIN { use_ok 'Try::Tiny' } +use Try::Tiny; use 5.010; +no if "$]" >= 5.017011, warnings => 'experimental::smartmatch'; my ( $foo, $bar, $other ); $_ = "magic"; try { - die "foo"; + die "foo"; } catch { - like( $_, qr/foo/ ); + like( $_, qr/foo/ ); - when (/bar/) { $bar++ }; - when (/foo/) { $foo++ }; - default { $other++ }; + when (/bar/) { $bar++ }; + when (/foo/) { $foo++ }; + default { $other++ }; }; is( $_, "magic", '$_ not clobbered' );