fix unit_stats.t for new Time::HiRes
Graham Knop [Tue, 27 Mar 2018 16:03:22 +0000 (18:03 +0200)]
tv_interval has been implemented in XS rather than as a wrapper, so it
has to be mocked as well.

t/unit_stats.t

index 09778c9..5aced0a 100644 (file)
@@ -2,13 +2,17 @@ use strict;
 use warnings;
 
 use Test::More tests => 13;
-use Time::HiRes qw/gettimeofday/;
+use Time::HiRes ();
 use Tree::Simple;
 
 my @fudge_t = ( 0, 0 );
 BEGIN {
     no warnings;
     *Time::HiRes::gettimeofday = sub () { return @fudge_t };
+    my $original_tv_interval = \&Time::HiRes::tv_interval;
+    *Time::HiRes::tv_interval = sub ($;@) {
+        return $original_tv_interval->($_[0], $_[1] || [Time::HiRes::gettimeofday()]);
+    };
 }
 
 BEGIN { use_ok("Catalyst::Stats") };