3 # test the "l", "lib", "try" and "only" options:
12 unshift @INC, '../lib';
21 no warnings 'redefine';
22 *Carp::carp = sub { push @W, $_[0]; };
25 my $rc = eval ('bignum->import( "l" => "foo" );');
26 is ($@,''); # shouldn't die
27 is (scalar @W, 1, 'one warning');
28 like ($W[0], qr/fallback to Math::/, 'got fallback');
30 $rc = eval ('bignum->import( "lib" => "foo" );');
32 is (scalar @W, 2, 'two warnings');
33 like ($W[1], qr/fallback to Math::/, 'got fallback');
35 $rc = eval ('bignum->import( "try" => "foo" );');
36 is ($@,''); # shouldn't die
37 $rc = eval ('bignum->import( "try" => "foo" );');
40 $rc = eval ('bignum->import( "foo" => "bar" );');
41 like ($@, qr/^Unknown option foo/i, 'died'); # should die
43 $rc = eval ('bignum->import( "only" => "bar" );');
44 like ($@, qr/fallback disallowed/i, 'died'); # should die
46 # test that options are only lowercase (don't see a reason why allow UPPER)
48 foreach (qw/L LIB Lib T Trace TRACE V Version VERSION/)
50 $rc = eval ('bignum->import( "$_" => "bar" );');
51 like ($@, qr/^Unknown option $_/i, 'died'); # should die