Subject: | Test::TestCoverage makes Moose not calling to BUILD method |
Found that BUILD methods are not being called in tests using
Test::TestCoverage on Moose objects. Please, see the proof of concept
attached files.
-----------------------------------------------------------------
---
Flags:
category=core
severity=high
---
Site configuration information for perl 5.12.3:
Configured by Alex at Fri Apr 15 02:45:00 CEST 2011.
Summary of my perl5 (revision 5 version 12 subversion 3) configuration:
Platform:
osname=linux, osvers=2.6.35-28-generic-pae,
archname=i686-linux-thread-multi
uname='linux ix 2.6.35-28-generic-pae #49-ubuntu smp tue mar 1
14:58:06 utc 2011 i686 gnulinux '
config_args='-de
-Dprefix=/home/alexm/perl5/perlbrew/perls/perl-5.12.3 -Dusethreads
-Dcf_by=Alex -Dcf_email=alexm@cpan.org'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.4.5', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/lib64
libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.12.1.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.12.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib
-fstack-protector'
Locally applied patches:
---
@INC for perl 5.12.3:
/home/alexm/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/i686-linux-thread-multi
/home/alexm/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3
/home/alexm/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3/i686-linux-thread-multi
/home/alexm/perl5/perlbrew/perls/perl-5.12.3/lib/5.12.3
.
---
Environment for perl 5.12.3:
HOME=/home/alexm
LANG=ca_ES.utf8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/alexm/perl5/perlbrew/bin:/home/alexm/perl5/perlbrew/perls/perl-5.12.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
PERLBREW_PATH=/home/alexm/perl5/perlbrew/bin:/home/alexm/perl5/perlbrew/perls/perl-5.12.3/bin
PERLBREW_PERL=perl-5.12.3
PERLBREW_ROOT=/home/alexm/perl5/perlbrew
PERLBREW_VERSION=0.18
PERL_BADLANG (unset)
SHELL=/bin/bash
Subject: | foobar-fail.t |
#!perl
use strict;
use warnings;
use Test::More;
use Test::TestCoverage;
my $class = 'Foobar';
test_coverage($class);
test_coverage_except( $class, qw( BUILD meta ) );
use_ok($class);
my $obj = new_ok( $class => [] );
is( $obj->attr, 'foobar', 'attr is foobar' );
ok_test_coverage($class);
done_testing();
Subject: | Foobar.pm |
package Foobar;
use strict;
use warnings;
use Moose;
has 'attr' => (
is => 'rw',
isa => 'Str',
);
sub BUILD {
my $self = shift;
$self->attr( 'foobar' );
}
1;
Subject: | foobar-pass.t |
#!perl
use strict;
use warnings;
use Test::More;
my $class = 'Foobar';
use_ok($class);
my $obj = new_ok( $class => [] );
is( $obj->attr, 'foobar', 'attr is foobar' );
done_testing();