In perl.git, the branch jkeenan/131531-benchmark has been updated <http://perl5.git.perl.org/perl.git/commitdiff/08f2f7aa998457332fffa2bdea5aafb54b1e6849?hp=76bc4a6fabba14919805ee597a20b7c99f69992b>
- Log ----------------------------------------------------------------- commit 08f2f7aa998457332fffa2bdea5aafb54b1e6849 Author: James E Keenan <[email protected]> Date: Wed Jun 7 19:47:48 2017 -0400 Add test file which is stripped-down version of lib/Benchmark.t. ----------------------------------------------------------------------- Summary of changes: lib/yBenchmark.t | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/yBenchmark.t diff --git a/lib/yBenchmark.t b/lib/yBenchmark.t new file mode 100644 index 0000000000..15b6cdf681 --- /dev/null +++ b/lib/yBenchmark.t @@ -0,0 +1,23 @@ +#!./perl -w +# https://rt.perl.org/Ticket/Display.html?id=131531 +BEGIN { + chdir 't' if -d 't'; + @INC = ('../lib'); +} + +use warnings; +use strict; + +use Benchmark qw(:all); +$Benchmark::Debug++; + +my $foo = 0; +my $reps = 5; +my $coderef = sub {++$foo}; +my $t = timeit($reps, $coderef); +($t->isa('Benchmark')) + ? print "timeit CODEREF returned a Benchmark object\n" + : print "timeit CODEREF did NOT return a Benchmark object\n"; +($foo == $reps) + ? print "benchmarked code was run $reps times\n" + : print "FAIL: requested $reps reps, but $foo were run\n"; -- Perl5 Master Repository
