This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor t/op/time.t to use test.pl's warning_is().
authorNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 09:12:19 +0000 (09:12 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 6 Mar 2011 09:12:53 +0000 (09:12 +0000)
t/op/time.t

index 7db8ee8..4ac7f5b 100644 (file)
@@ -140,16 +140,10 @@ ok(gmtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ]
 
 # Test floating point args
 {
-    eval {
-        $SIG{__WARN__} = sub { die @_; };
-        is( (localtime(1296000.23))[5] + 1900, 1970 );
-    };
-    is($@, '', 'Ignore fractional time');
-    eval {
-        $SIG{__WARN__} = sub { die @_; };
-        is( (gmtime(1.23))[5] + 1900, 1970 );
-    };
-    is($@, '', 'Ignore fractional time');
+    warning_is(sub {is( (localtime(1296000.23))[5] + 1900, 1970 )},
+              undef, 'Ignore fractional time');
+    warning_is(sub {is( (gmtime(1.23))[5] + 1900, 1970 )},
+              undef, 'Ignore fractional time');
 }