I think this is quite enough testing for a deprecated feature.
[p5sagit/p5-mst-13.2.git] / t / lib / fields.t
index 310967f..b4b5cce 100755 (executable)
@@ -4,7 +4,7 @@ my $w;
 
 BEGIN {
    chdir 't' if -d 't';
-   unshift @INC, '../lib' if -d '../lib';
+   @INC = '../lib';
    $SIG{__WARN__} = sub {
        if ($_[0] =~ /^Hides field 'b1' in base class/) {
            $w++;
@@ -15,6 +15,7 @@ BEGIN {
 }
 
 use strict;
+use warnings;
 use vars qw($DEBUG);
 
 package B1;
@@ -89,7 +90,7 @@ my %expect = (
     'Foo::Bar::Baz' => 'b1:1,b2:2,b3:3,foo:4,bar:5,baz:6',
 );
 
-print "1..", int(keys %expect)+13, "\n";
+print "1..", int(keys %expect)+15, "\n";
 my $testno = 0;
 while (my($class, $exp) = each %expect) {
    no strict 'refs';
@@ -169,3 +170,28 @@ print "ok ", ++$testno, "\n";
     print $a->{foo}[1], "\n";
     print $a->{bar}->{A}, "\n";
 }
+
+
+# Test $VERSION bug
+package No::Version;
+
+use vars qw($Foo);
+sub VERSION { 42 }
+
+package Test::Version;
+
+use base qw(No::Version);
+print "not " unless $No::Version::VERSION =~ /set by base\.pm/;
+print "ok ", ++$testno ,"\n";
+
+# Test Inverse of $VERSION bug base.pm should not clobber existing $VERSION
+package Has::Version;
+
+BEGIN { $Has::Version::VERSION = '42' };
+
+package Test::Version2;
+
+use base qw(Has::Version);
+print "#$Has::Version::VERSION\nnot " unless $Has::Version::VERSION eq '42';
+print "ok ", ++$testno ,"\n";
+