1#!/usr/bin/perl -w 2 3BEGIN { 4 if( $ENV{PERL_CORE} ) { 5 chdir 't'; 6 @INC = '../lib'; 7 } 8 else { 9 unshift @INC, 't/lib'; 10 } 11} 12chdir 't'; 13 14use Test::More tests => 10; 15use ExtUtils::MakeMaker; 16 17my %versions = ('$VERSION = 0.02' => 0.02, 18 '$VERSION = 0.0' => 0.0, 19 '$VERSION = -1.0' => -1.0, 20 '$VERSION = undef' => 'undef', 21 '$wibble = 1.0' => 'undef', 22 ); 23 24while( my($code, $expect) = each %versions ) { 25 open(FILE, ">VERSION.tmp") || die $!; 26 print FILE "$code\n"; 27 close FILE; 28 29 $_ = 'foo'; 30 is( MM->parse_version('VERSION.tmp'), $expect, $code ); 31 is( $_, 'foo', '$_ not leaked by parse_version' ); 32 33 unlink "VERSION.tmp"; 34} 35