1*0Sstevel@tonic-gate#!/usr/bin/perl -w 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateuse strict; 4*0Sstevel@tonic-gateuse Test::More tests => 10; 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gateuse_ok('base'); 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate 9*0Sstevel@tonic-gatepackage No::Version; 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gateuse vars qw($Foo); 12*0Sstevel@tonic-gatesub VERSION { 42 } 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gatepackage Test::Version; 15*0Sstevel@tonic-gate 16*0Sstevel@tonic-gateuse base qw(No::Version); 17*0Sstevel@tonic-gate::ok( $No::Version::VERSION =~ /set by base\.pm/, '$VERSION bug' ); 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate# Test Inverse of $VERSION bug base.pm should not clobber existing $VERSION 20*0Sstevel@tonic-gatepackage Has::Version; 21*0Sstevel@tonic-gate 22*0Sstevel@tonic-gateBEGIN { $Has::Version::VERSION = '42' }; 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gatepackage Test::Version2; 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gateuse base qw(Has::Version); 27*0Sstevel@tonic-gate::is( $Has::Version::VERSION, 42 ); 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gatepackage main; 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gatemy $eval1 = q{ 32*0Sstevel@tonic-gate { 33*0Sstevel@tonic-gate package Eval1; 34*0Sstevel@tonic-gate { 35*0Sstevel@tonic-gate package Eval2; 36*0Sstevel@tonic-gate use base 'Eval1'; 37*0Sstevel@tonic-gate $Eval2::VERSION = "1.02"; 38*0Sstevel@tonic-gate } 39*0Sstevel@tonic-gate $Eval1::VERSION = "1.01"; 40*0Sstevel@tonic-gate } 41*0Sstevel@tonic-gate}; 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gateeval $eval1; 44*0Sstevel@tonic-gateis( $@, '' ); 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gateis( $Eval1::VERSION, 1.01 ); 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gateis( $Eval2::VERSION, 1.02 ); 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gateeval q{use base 'reallyReAlLyNotexists'}; 52*0Sstevel@tonic-gatelike( $@, qr/^Base class package "reallyReAlLyNotexists" is empty./, 53*0Sstevel@tonic-gate 'base with empty package'); 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gateeval q{use base 'reallyReAlLyNotexists'}; 56*0Sstevel@tonic-gatelike( $@, qr/^Base class package "reallyReAlLyNotexists" is empty./, 57*0Sstevel@tonic-gate ' still empty on 2nd load'); 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gateBEGIN { $Has::Version_0::VERSION = 0 } 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gatepackage Test::Version3; 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gateuse base qw(Has::Version_0); 64*0Sstevel@tonic-gate::is( $Has::Version_0::VERSION, 0, '$VERSION==0 preserved' ); 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gatepackage Test::SIGDIE; 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate{ 70*0Sstevel@tonic-gate local $SIG{__DIE__} = sub { 71*0Sstevel@tonic-gate ::fail('sigdie not caught, this test should not run') 72*0Sstevel@tonic-gate }; 73*0Sstevel@tonic-gate eval { 74*0Sstevel@tonic-gate 'base'->import(qw(Huh::Boo)); 75*0Sstevel@tonic-gate }; 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate ::like($@, qr/^Base class package "Huh::Boo" is empty/, 78*0Sstevel@tonic-gate 'Base class empty error message'); 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate} 81