diff options
author | Chris Williams <chris@bingosnet.co.uk> | 2009-09-10 21:30:20 +0100 |
---|---|---|
committer | Chris Williams <chris@bingosnet.co.uk> | 2009-09-10 21:30:20 +0100 |
commit | a3bef8ed8dece3b48e9e11993f255fbe719a0647 (patch) | |
tree | a1c54009ef1eb097495c49c44bb8b4133a93c5aa /ext/bignum/t/option_l.t | |
parent | 5711376d83710d8f98ce1dc447317524afb70055 (diff) | |
download | perl-a3bef8ed8dece3b48e9e11993f255fbe719a0647.tar.gz |
Moved bignum from lib/ to ext/
Diffstat (limited to 'ext/bignum/t/option_l.t')
-rw-r--r-- | ext/bignum/t/option_l.t | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/bignum/t/option_l.t b/ext/bignum/t/option_l.t new file mode 100644 index 0000000000..cfa8033f22 --- /dev/null +++ b/ext/bignum/t/option_l.t @@ -0,0 +1,54 @@ +#!/usr/bin/perl -w + +# test the "l", "lib", "try" and "only" options: + +use Test::More; +use strict; + +BEGIN + { + $| = 1; + chdir 't' if -d 't'; + unshift @INC, '../lib'; + 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/) + { + $rc = eval ('bignum->import( "$_" => "bar" );'); + like ($@, qr/^Unknown option $_/i, 'died'); # should die + } + |