Upgrade to prereleases of Math::BigInt 1.70 and
[p5sagit/p5-mst-13.2.git] / lib / Math / BigInt / t / req_mbfw.t
1 #!/usr/bin/perl -w
2
3 # check that requiring BigFloat and then calling import() works
4
5 use strict;
6 use Test;
7
8 BEGIN
9   {
10   $| = 1;
11   # to locate the testing files
12   my $location = $0; $location =~ s/req_mbfw.t//i;
13   if ($ENV{PERL_CORE})
14     {
15     # testing with the core distribution
16     @INC = qw(../t/lib);
17     }
18   unshift @INC, qw(../lib);     # to locate the modules
19   if (-d 't')
20     {
21     chdir 't';
22     require File::Spec;
23     unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
24     }
25   else
26     {
27     unshift @INC, $location;
28     }
29   print "# INC = @INC\n";
30
31   plan tests => 3;
32   } 
33
34 # normal require that calls import automatically (we thus have MBI afterwards)
35 require Math::BigFloat; my $x = Math::BigFloat->new(1);  ++$x; ok ($x,2);
36
37 ok (Math::BigFloat->config()->{with}, 'Math::BigInt::Calc' );
38
39 # now override
40 Math::BigFloat->import ( with => 'Math::BigInt::Subclass' );
41
42 # thw with argument is ignored
43 ok (Math::BigFloat->config()->{with}, 'Math::BigInt::Calc' );
44
45 # all tests done
46