diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-27 15:55:15 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-07-03 16:36:40 +0200 |
commit | 9ee672c4fa6995a1f140f22875725b125131d674 (patch) | |
tree | ecfd939d0b32c441446778163f8d7671d3e8a79c /dist/B-Deparse | |
parent | 8ab77384e7912bb422da3f271de0ff759d9e0647 (diff) | |
download | perl-9ee672c4fa6995a1f140f22875725b125131d674.tar.gz |
Convert B::Deparse's core.t to Test::More.
Bring the joy of strict to it, remove the unused variable @bin, and convert a
literal carriage return to a newline.
Diffstat (limited to 'dist/B-Deparse')
-rw-r--r-- | dist/B-Deparse/t/core.t | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/dist/B-Deparse/t/core.t b/dist/B-Deparse/t/core.t index 11eabc0f8b..b4e1a6e1af 100644 --- a/dist/B-Deparse/t/core.t +++ b/dist/B-Deparse/t/core.t @@ -1,11 +1,15 @@ #!./perl BEGIN { - unshift @INC, 't','../../t'; - require 'test.pl'; - skip_all_without_dynamic_extension('B'); + require Config; + if (($Config::Config{extensions} !~ /\bB\b/) ){ + print "1..0 # Skip -- Perl configured without B module\n"; + exit 0; + } } +use strict; +use Test::More; # Many functions appear in multiple lists, so that shift() and shift(foo) # are both tested. @@ -55,10 +59,6 @@ my @nary = ( [qw( msgrcv open socketpair splice )] ); -my $tests = @bin + 13; -$tests += @$_ for @nary; -plan $tests; - use B::Deparse; my $deparse = new B::Deparse; @@ -69,7 +69,7 @@ sub CORE_test { import subs $keyword; ::like $deparse->coderef2text( - eval "sub { () = $expr }" or die "$@in $expr" + eval "no strict 'vars'; sub { () = $expr }" or die "$@in $expr" ), qr/\sCORE::$keyword.*;/, $name||$keyword @@ -78,7 +78,8 @@ sub CORE_test { for my $argc(0..$#nary) { for(@{$nary[$argc]}) { CORE_test - $_,
"CORE::$_(" . join(',',map "\$$_", (undef,"a".."z")[1..$argc]) . ")", + $_, + "CORE::$_(" . join(',',map "\$$_", (undef,"a".."z")[1..$argc]) . ")", "$_, $argc argument" . "s"x($argc != 1); } } @@ -103,3 +104,5 @@ CORE_test readpipe => 'CORE::readpipe $a+$b', 'readpipe'; # Tests for prefixing feature.pm-enabled keywords with CORE:: when # feature.pm is not enabled are in deparse.t, as they fit that for- # mat better. + +done_testing(); |