1#!/usr/bin/perl -w
2
3# check that using BigFloat with "with" and "lib" at the same time works
4# broken in versions up to v1.63
5
6use strict;
7use Test;
8
9BEGIN
10  {
11  $| = 1;
12  # to locate the testing files
13  my $location = $0; $location =~ s/use_mbfw.t//i;
14  if ($ENV{PERL_CORE})
15    {
16    # testing with the core distribution
17    @INC = qw(../t/lib);
18    }
19  unshift @INC, qw(../lib);     # to locate the modules
20  if (-d 't')
21    {
22    chdir 't';
23    require File::Spec;
24    unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
25    }
26  else
27    {
28    unshift @INC, $location;
29    }
30  print "# INC = @INC\n";
31
32  plan tests => 2;
33  }
34
35
36# the replacement lib can handle the lib statement, but it could also ignore
37# it completely, for instance, when it is a 100% replacement for BigInt, but
38# doesn't know the concept of alternative libs. But it still needs to cope
39# with "lib => ". SubClass does record it, so we test here essential if
40# BigFloat hands the lib properly down, any more is outside out testing reach.
41
42use Math::BigFloat with => 'Math::BigInt::Subclass', lib => 'BareCalc';
43
44ok (Math::BigFloat->config()->{with}, 'Math::BigInt::BareCalc' );
45
46# ok ($Math::BigInt::Subclass::lib, 'BareCalc' );
47
48# it never arrives here, but that is a design decision in SubClass
49ok (Math::BigInt->config->{lib}, 'Math::BigInt::BareCalc' );
50
51# all tests done
52
53