From: Jarkko Hietaniemi Date: Thu, 7 Aug 2003 18:14:41 +0000 (+0000) Subject: The #20546 was too ambitious, broke the test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f695f0e6874001cf0696a1b1ec3411efe80ba2a9;p=p5sagit%2Fp5-mst-13.2.git The #20546 was too ambitious, broke the test. p4raw-id: //depot/perl@20556 --- diff --git a/lib/Benchmark.pm b/lib/Benchmark.pm index 0ca7c59..c472d58 100644 --- a/lib/Benchmark.pm +++ b/lib/Benchmark.pm @@ -485,19 +485,39 @@ sub usage { # The cache needs two branches: 's' for strings and 'c' for code. The # empty loop is different in these two cases. -sub clearcache ($) { +$_Usage{clearcache} = <<'USAGE'; +usage: clearcache($count); +USAGE + +sub clearcache { + die usage unless @_ == 1; delete $Cache{"$_[0]c"}; delete $Cache{"$_[0]s"}; } -sub clearallcache () { +$_Usage{clearallcache} = <<'USAGE'; +usage: clearallcache(); +USAGE + +sub clearallcache { + die usage if @_; %Cache = (); } -sub enablecache () { +$_Usage{enablecache} = <<'USAGE'; +usage: enablecache(); +USAGE + +sub enablecache { + die usage if @_; $Do_Cache = 1; } -sub disablecache () { +$_Usage{disablecache} = <<'USAGE'; +usage: disablecache(); +USAGE + +sub disablecache { + die usage if @_; $Do_Cache = 0; } diff --git a/lib/Benchmark.t b/lib/Benchmark.t index b4d7149..8081476 100644 --- a/lib/Benchmark.t +++ b/lib/Benchmark.t @@ -583,7 +583,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" ); } }