bignum 0.22 take 4 (hex()/oct() overloading)
[p5sagit/p5-mst-13.2.git] / lib / bignum / t / scope_f.t
CommitLineData
4440d13a 1#!/usr/bin/perl -w
2
3###############################################################################
d1a15766 4# Test "no bignum;" and overloading of hex()/oct() for newer Perls
4440d13a 5
6use Test::More;
7use strict;
8
9BEGIN
10 {
11 $| = 1;
12 chdir 't' if -d 't';
13 unshift @INC, '../lib';
d1a15766 14 plan tests => 10;
4440d13a 15 }
16
d1a15766 17# no :hex and :oct means these do not get overloaded for older Perls:
4440d13a 18use bignum;
19
20isnt (ref(1), '', 'is in effect');
21isnt (ref(2.0), '', 'is in effect');
22isnt (ref(0x20), '', 'is in effect');
23
d1a15766 24SKIP: {
25 skip ('Need at least Perl v5.9.4', 2) if $] < 5.009004;
26
27 is (ref(hex(9)), 'Math::BigInt', 'hex is overloaded');
28 is (ref(oct(07)), 'Math::BigInt', 'oct is overloaded');
29 }
30
4440d13a 31{
32 no bignum;
33
34 is (ref(1), '', 'is not in effect');
35 is (ref(2.0), '', 'is not in effect');
36 is (ref(0x20), '', 'is not in effect');
d1a15766 37
38 isnt (ref(hex(9)), 'Math::BigInt', 'hex is not overloaded');
39 isnt (ref(oct(07)), 'Math::BigInt', 'oct is not overloaded');
4440d13a 40}
41