X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2FControlStructures%2FProhibitUnreachableCode.run;fp=dev%2Fi386%2Flibperl-critic-perl%2Flibperl-critic-perl-1.088%2Ft%2FControlStructures%2FProhibitUnreachableCode.run;h=dd6f2e33620d07b52b706f3f7a6f632f66f37a56;hp=0000000000000000000000000000000000000000;hb=da95c414033799c3a62606f299c3c00b5c77ca11;hpb=2d38e14bacbb15b98e539843a40b3c52a225f493 diff --git a/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUnreachableCode.run b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUnreachableCode.run new file mode 100644 index 0000000..dd6f2e3 --- /dev/null +++ b/dev/i386/libperl-critic-perl/libperl-critic-perl-1.088/t/ControlStructures/ProhibitUnreachableCode.run @@ -0,0 +1,200 @@ +## name Basic passing +## failures 0 +## cut + +sub a { + return 123 if $a == 1; + do_something(); +} + +sub b { + croak 'error' unless $b; + do_something(); +} + +sub c { + confess 'error' if $c != $d; + do_something(); +} + +for (1..2) { + next if $_ == 1; + do_something(); +} + +for (1..2) { + last if $_ == 2; + do_something(); +} + +for (1..2) { + redo if do_this($_); + do_something(); +} + +{ + exit; + FOO: + do_something(); +} + +{ + die; + BAR: + do_something(); +} + +{ + exit; + sub d {} + BAZ: + print 123; +} + +{ + die; + JAPH: + sub e {} + print 456; +} + +{ + exit; + BEGIN { + print 123; + } +} + +{ + $foo || die; + print 123; +} + +#----------------------------------------------------------------------------- + +## name Basic failure +## failures 12 +## cut + +{ + exit; + require Foo; +} + +sub a { + return 123; + do_something(); +} + +sub b { + croak 'error'; + do_something(); +} + +sub c { + confess 'error'; + do_something(); +} + +for (1..2) { + next; + do_something(); +} + +for (1..2) { + last; + do_something(); +} + +for (1..2) { + redo; + do_something(); +} + +{ + exit; + do_something(); +} + + +{ + die; + do_something(); +} + + +{ + exit; + sub d {} + print 123; +} + +{ + $foo, die; + print 123; +} + +die; +print 456; +FOO: print $baz; + +#----------------------------------------------------------------------------- + +## name Compile-time code +## failures 0 +## cut + +exit; + +no warnings; +use Memoize; +our %memoization; + +#----------------------------------------------------------------------------- + +## name __DATA__ section +## failures 0 +## cut + +exit; + +__DATA__ +... + +#----------------------------------------------------------------------------- + +## name __END__ section +## failures 0 +## cut + +exit; + +__END__ +... + +#----------------------------------------------------------------------------- + +## name RT #36080 +## failures 0 +## cut + +my $home = $ENV{HOME} // die "HOME not set"; +say 'hello'; + +#----------------------------------------------------------------------------- + +############################################################################## +# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/ControlStructures/ProhibitUnreachableCode.run $ +# $Date: 2008-05-21 14:50:31 -0500 (Wed, 21 May 2008) $ +# $Author: clonezone $ +# $Revision: 2397 $ +############################################################################## + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 78 +# indent-tabs-mode: nil +# c-indentation-style: bsd +# End: +# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :