This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
bignum tests: use eval-block instead of eval-string
authorOlivier Mengué <dolmen@cpan.org>
Thu, 4 Sep 2014 22:34:04 +0000 (00:34 +0200)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 5 Sep 2014 01:09:01 +0000 (18:09 -0700)
dist/bignum/t/option_l.t

index d8c6b87..b5eddec 100644 (file)
@@ -15,32 +15,32 @@ no warnings 'redefine';
 *Carp::carp = sub { push @W, $_[0]; };
 }
 
-my $rc = eval ('bignum->import( "l" => "foo" );');
+my $rc = eval { bignum->import( "l" => "foo" ) };
 is ($@,'');                                            # shouldn't die
 is (scalar @W, 1, 'one warning');
 like ($W[0], qr/fallback to Math::/, 'got fallback');
 
-$rc = eval ('bignum->import( "lib" => "foo" );');
+$rc = eval { bignum->import( "lib" => "foo" ) };
 is ($@,'');                                            # ditto
 is (scalar @W, 2, 'two warnings');
 like ($W[1], qr/fallback to Math::/, 'got fallback');
 
-$rc = eval ('bignum->import( "try" => "foo" );');
+$rc = eval { bignum->import( "try" => "foo" ) };
 is ($@,'');                                            # shouldn't die
-$rc = eval ('bignum->import( "try" => "foo" );');
+$rc = eval { bignum->import( "try" => "foo" ) };
 is ($@,'');                                            # ditto
 
-$rc = eval ('bignum->import( "foo" => "bar" );');
+$rc = eval { bignum->import( "foo" => "bar" ) };
 like ($@, qr/^Unknown option foo/i, 'died');                   # should die
 
-$rc = eval ('bignum->import( "only" => "bar" );');
+$rc = eval { bignum->import( "only" => "bar" ) };
 like ($@, qr/fallback disallowed/i, 'died');                   # should die
 
 # test that options are only lowercase (don't see a reason why allow UPPER)
 
 foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/)
   {
-  $rc = eval ('bignum->import( "$_" => "bar" );');
+  $rc = eval { bignum->import( $_ => "bar" ) };
   like ($@, qr/^Unknown option $_/i, 'died');                  # should die
   }