This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make lib/warnings.t use t/test.pl
[perl5.git] / lib / Benchmark.t
index b4d7149..3a7a1de 100644 (file)
@@ -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" );
     }
 }