Subject: | Tests using "package B" conflict with the real B.pm |
The Spiffy tests use "package B" a lot. This can conflict with B.pm if
it were to be loaded by anything the Spiffy tests use causing the tests
to fail. It turns out the next major version of Test::More will do this.
https://metacpan.org/release/MSCHWERN/Test-Simple-1.005000_001/
The attached patch changes B to Bicycle to avoid conflict.
Subject: | spiffy.patch |
diff --git a/t/autoload.t b/t/autoload.t
index 206c68f..ae1ed73 100644
--- a/t/autoload.t
+++ b/t/autoload.t
@@ -11,7 +11,7 @@ sub AUTOLOAD {
join '+', $A::AUTOLOAD, @_;
}
-package B;
+package Bicycle;
use base 'A';
sub AUTOLOAD {
@@ -19,7 +19,7 @@ sub AUTOLOAD {
}
package C;
-use base 'B';
+use base 'Bicycle';
sub AUTOLOAD {
super;
diff --git a/t/export2.t b/t/export2.t
index 2a14dd7..7484c62 100644
--- a/t/export2.t
+++ b/t/export2.t
@@ -7,16 +7,16 @@ BEGIN {@A::EXPORT = qw($A1 $A2)}
$A::A1 = 5;
$A::A2 = 10;
-package B;
+package Bicycle;
use base 'A';
-BEGIN {@B::EXPORT = qw($A2 $A3)}
-$B::A2 = 15;
-$B::A3 = 20;
+BEGIN {@Bicycle::EXPORT = qw($A2 $A3)}
+$Bicycle::A2 = 15;
+$Bicycle::A3 = 20;
package main;
use strict;
use Test::More tests => 6;
-BEGIN {B->import}
+BEGIN {Bicycle->import}
ok(defined $main::A1);
ok(defined $main::A2);
ok(defined $main::A3);
diff --git a/t/export3.t b/t/export3.t
index 2e76659..7f62c3a 100644
--- a/t/export3.t
+++ b/t/export3.t
@@ -8,16 +8,16 @@ BEGIN {@A::EXPORT_OK = qw($A1 $A2)}
$A::A1 = 5;
$A::A2 = 10;
-package B;
+package Bicycle;
use base 'A';
-BEGIN {@B::EXPORT_OK = qw($A2 $A3)}
-$B::A2 = 15;
-$B::A3 = 20;
+BEGIN {@Bicycle::EXPORT_OK = qw($A2 $A3)}
+$Bicycle::A2 = 15;
+$Bicycle::A3 = 20;
package main;
no warnings;
use Test::More tests => 7;
-BEGIN {B->import(qw($A1 $A2 $A3 $A4))}
+BEGIN {Bicycle->import(qw($A1 $A2 $A3 $A4))}
ok(defined $main::A1);
ok(defined $main::A2);
ok(defined $main::A3);
diff --git a/t/export4.t b/t/export4.t
index 1330293..aacdde1 100644
--- a/t/export4.t
+++ b/t/export4.t
@@ -6,7 +6,7 @@ package A;
# Exporter before 5.8.4 needs the tag as the first thing imported
use Spiffy -base, qw(:XXX const);
-package B;
+package Bicycle;
use base 'A';
package C;
@@ -30,10 +30,10 @@ ok(defined &A::const);
ok(defined &A::XXX);
ok(defined &A::YYY);
-ok(defined &B::field);
-ok(defined &B::const);
-ok(not defined &B::XXX);
-ok(not defined &B::YYY);
+ok(defined &Bicycle::field);
+ok(defined &Bicycle::const);
+ok(not defined &Bicycle::XXX);
+ok(not defined &Bicycle::YYY);
ok(defined &C::field);
ok(defined &C::const);
diff --git a/t/export5.t b/t/export5.t
index e9f8d8c..c8f48b9 100644
--- a/t/export5.t
+++ b/t/export5.t
@@ -7,15 +7,15 @@ use Spiffy -base;
BEGIN {@A::EXPORT_OK = qw(dude)}
const dude => 10;
-package B;
+package Bicycle;
use base 'A';
BEGIN {
- @B::EXPORT_OK = qw(dude);
+ @Bicycle::EXPORT_OK = qw(dude);
const dude => 20;
}
package C;
-BEGIN {B->import('dude')}
+BEGIN {Bicycle->import('dude')}
package main;
no warnings;
diff --git a/t/export6.t b/t/export6.t
index 5620f12..d631233 100644
--- a/t/export6.t
+++ b/t/export6.t
@@ -5,12 +5,12 @@ use warnings;
package A;
use Spiffy -Base, ':XXX';
-package B;
+package Bicycle;
use Spiffy -Base, ':XXX', 'field';
package main;
use Test::More tests => 4;
ok(not defined &A::field);
-ok(defined &B::field);
+ok(defined &Bicycle::field);
ok(defined &A::XXX);
-ok(defined &B::XXX);
+ok(defined &Bicycle::XXX);
diff --git a/t/export7.t b/t/export7.t
index badadba..8a2715c 100644
--- a/t/export7.t
+++ b/t/export7.t
@@ -2,7 +2,7 @@ use Test::More;
plan tests => 4;
-package B;
+package Bicycle;
use Spiffy -Base, -XXX;
package A;
@@ -13,5 +13,5 @@ package main;
ok(not defined &A::XXX);
ok(defined &A::field);
-ok(defined &B::XXX);
-ok(defined &B::field);
+ok(defined &Bicycle::XXX);
+ok(defined &Bicycle::field);
diff --git a/t/mixin3.t b/t/mixin3.t
index 19a2321..f215f00 100644
--- a/t/mixin3.t
+++ b/t/mixin3.t
@@ -2,7 +2,7 @@ use lib 't', 'lib';
package A;
use Spiffy -Base;
-package B;
+package Bicycle;
use Spiffy -Base;
field foo => 42;
@@ -11,5 +11,5 @@ package main;
use Test::More tests => 1;
my $a = A->new;
-$a->mixin('B');
+$a->mixin('Bicycle');
is($a->foo, 42);