Upgrade to ExtUtils-Manifest-1.49.
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / parse_version.t
1 #!/usr/bin/perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = '../lib';
7     }
8     else {
9         unshift @INC, 't/lib';
10     }
11 }
12 chdir 't';
13
14 use Test::More tests => 10;
15 use ExtUtils::MakeMaker;
16
17 my %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
24 while( 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 }