diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2007-05-09 17:05:52 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-05-10 08:50:44 +0000 |
commit | 48441d71a001d55993adc5d7cf3c122d8b13b721 (patch) | |
tree | e448336ebfaac5d27a069c2bec795a46a50097fa /lib/bignum | |
parent | 104a8018a78d3956ea3ab53f0abbda41773a7f35 (diff) | |
download | perl-48441d71a001d55993adc5d7cf3c122d8b13b721.tar.gz |
Fix bignum-0.21
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510705091805n37c4137u16a35ca27810979f@mail.gmail.com>
p4raw-id: //depot/perl@31191
Diffstat (limited to 'lib/bignum')
-rwxr-xr-x | lib/bignum/t/option_l.t | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/bignum/t/option_l.t b/lib/bignum/t/option_l.t index f5341830c9..cfa8033f22 100755 --- a/lib/bignum/t/option_l.t +++ b/lib/bignum/t/option_l.t @@ -1,5 +1,7 @@ #!/usr/bin/perl -w +# test the "l", "lib", "try" and "only" options: + use Test::More; use strict; @@ -8,19 +10,40 @@ BEGIN $| = 1; chdir 't' if -d 't'; unshift @INC, '../lib'; - plan tests => 12; + plan tests => 19; } use bignum; +my @W; +{ +# catch warnings: +require Carp; +no warnings 'redefine'; +*Carp::carp = sub { push @W, $_[0]; }; +} + 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" );'); is ($@,''); # ditto +is (scalar @W, 2, 'two warnings'); +like ($W[1], qr/fallback to Math::/, 'got fallback'); + +$rc = eval ('bignum->import( "try" => "foo" );'); +is ($@,''); # shouldn't die +$rc = eval ('bignum->import( "try" => "foo" );'); +is ($@,''); # ditto $rc = eval ('bignum->import( "foo" => "bar" );'); like ($@, qr/^Unknown option foo/i, 'died'); # should die +$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/) |