X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FBenchmark.t;h=3a7a1def8597a96bcb6a567ea9fdb6c82f1cd9dd;hb=c1e8580e8ecd78fc1f67b0caa695b9884a700d93;hp=b4d714931c502370936dc5b192b37a66e57520eb;hpb=359218de2862c98ccfadd5880b5a17387de633db;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Benchmark.t b/lib/Benchmark.t index b4d7149..3a7a1de 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -8,7 +8,7 @@ BEGIN { use warnings; use strict; use vars qw($foo $bar $baz $ballast); -use Test::More tests => 193; +use Test::More tests => 194; use Benchmark qw(:all); @@ -42,6 +42,11 @@ is ($foo, 5, "benchmarked code was run 5 times"); isa_ok(timeit(5, '++$bar'), 'Benchmark', "timeit eval"); is ($bar, 5, "benchmarked code was run 5 times"); +# is coderef called with spurious arguments? +timeit( 1, sub { $foo = @_ }); +is ($foo, 0, "benchmarked code called without arguments"); + + print "# Burning CPU to benchmark things will take time...\n"; @@ -583,7 +588,7 @@ is_deeply ([keys %Benchmark::Cache], \@before_keys, foreach my $func (@takes_no_args) { eval "$func(42)"; - like( $@, qr/Too many arguments for Benchmark::$func/, "$func usage: with args" ); + is( $@, $usage{$func}, "$func usage: with args" ); } }