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