X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fbignum%2Ft%2Foption_l.t;h=24b53fd3369de5a7217a060e79d6b2a941bcc843;hb=bd49aa0990860b27ed774e78523caa0fd4824ceb;hp=f5341830c9979bff93f91736b53ceabbd4fd3d30;hpb=e3b7d412e225646739735ee08e98041e0278f7bf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/bignum/t/option_l.t b/lib/bignum/t/option_l.t index f534183..24b53fd 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,39 @@ BEGIN $| = 1; chdir 't' if -d 't'; unshift @INC, '../lib'; - plan tests => 12; + plan tests => 19; } use bignum; +my @W; +{ +# catch warnings: +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/)