Last active
August 29, 2015 14:14
-
-
Save andyjones/b3eb7f6dca5c216ddf6e to your computer and use it in GitHub Desktop.
Simplified version of t/mouse.t from namespace::autoclean that fails under perl 5.8.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Test::More 0.88; | |
# Create a role | |
BEGIN { | |
package Some::Role; | |
use Mouse::Role; | |
use namespace::autoclean; | |
use constant CAT => 'kitten'; | |
} | |
# and apply the role to a class | |
BEGIN { | |
package Consuming::Class1; | |
use Mouse; | |
use namespace::autoclean; | |
BEGIN { with 'Some::Role'; }; # BEGIN block doesn't matter here | |
} | |
# apply the role to another class in a BEGIN block to trigger the issue | |
BEGIN { | |
package Consuming::Class2; | |
use Mouse; | |
use namespace::autoclean; | |
BEGIN { with 'Some::Role'; }; | |
} | |
subtest "Mouse::Role's are cleaned" => sub { | |
ok defined &Some::Role::CAT, | |
'Some::Role::CAT constant'; | |
}; | |
subtest "The first class is cleaned" => sub { | |
ok defined &Consuming::Class1::CAT, | |
'Consuming::Class1::CAT constant'; | |
}; | |
subtest "The second class is cleaned" => sub { | |
# This test blows up! | |
ok defined &Consuming::Class2::CAT, | |
'Consuming::Class2::CAT constant'; | |
}; | |
done_testing; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> cpanm -v namespace::autoclean | |
cpanm (App::cpanminus) 1.7001 on perl 5.008008 built for x86_64-linux-thread-multi | |
Work directory is /root/.cpanm/work/1422534323.7478 | |
You have make /usr/bin/make | |
You have LWP 5.837 | |
You have /bin/tar: tar (GNU tar) 1.15.1 | |
You have /usr/bin/unzip | |
Searching namespace::autoclean on cpanmetadb ... | |
--> Working on namespace::autoclean | |
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/namespace-autoclean-0.24.tar.gz ... OK | |
... output snipped ... | |
t/00-report-prereqs.t ...... # | |
# Versions for all modules listed in MYMETA.json (including optional ones): | |
# | |
# === Configure Requires === | |
# | |
# Module Want Have | |
# ------------------- ----- ----- | |
# Module::Build::Tiny 0.039 0.039 | |
# | |
# === Test Requires === | |
# | |
# Module Want Have | |
# ------------------- ---- -------- | |
# Carp any 1.3301 | |
# ExtUtils::MakeMaker any 7.04 | |
# File::Basename any 2.74 | |
# File::Spec any 3.47 | |
# Scalar::Util any 1.41 | |
# Test::More 0.88 1.001014 | |
# Test::Requires any 0.06 | |
# base any 2.07 | |
# constant any 1.05 | |
# overload any 1.04 | |
# | |
# === Test Recommends === | |
# | |
# Module Want Have | |
# ---------- -------- -------- | |
# CPAN::Meta 2.120900 2.143240 | |
# | |
# === Runtime Requires === | |
# | |
# Module Want Have | |
# -------------------- ---- ---- | |
# B::Hooks::EndOfScope 0.12 0.12 | |
# List::Util any 1.41 | |
# Sub::Identify any 0.10 | |
# namespace::clean 0.20 0.25 | |
# strict any 1.03 | |
# warnings any 1.05 | |
# | |
# === Other Modules === | |
# | |
# Module Want Have | |
# ----------------------------- ---- -------- | |
# Class::MOP any 2.1403 | |
# Moo any 1.005000 | |
# Moose any 2.1403 | |
# MooseX::Role::WithOverloading any missing | |
# Mouse any 2.4.1 | |
# Mouse::PurePerl any undef | |
# Sub::Install any 0.925 | |
# Sub::Name any 0.05 | |
# | |
... output snipped ... | |
t/mouse-pp.t ............... ok | |
t/mouse.t .................. 1/? | |
# Failed test 'Consuming::Class::InBegin::guff added via glob assignment' | |
# at t/mouse.t line 153. | |
# Failed test 'Consuming::Class::InBegin::CAT constant' | |
# at t/mouse.t line 169. | |
# Looks like you failed 2 tests of 40. | |
t/mouse.t .................. Dubious, test returned 2 (wstat 512, 0x200) | |
Failed 2/40 subtests | |
(5 TODO tests unexpectedly succeeded) | |
t/overload.t ............... ok | |
t/sub-install.t ............ ok | |
t/sub-name.t ............... ok | |
Test Summary Report | |
------------------- | |
t/mouse.t (Wstat: 512 Tests: 40 Failed: 2) | |
Failed tests: 33, 39 | |
TODO passed: 1, 6, 11, 21, 31 | |
Non-zero exit status: 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment