X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Antlers.git;a=blobdiff_plain;f=t%2Fone.t;fp=t%2Fone.t;h=eddb1125db4ef0db7153567b88c844eb803b4153;hp=0000000000000000000000000000000000000000;hb=a39b801f07ae3f019341068c428f1360efeb9886;hpb=b0fc4a7ab8621aeee2cf26874a5f2395b46af10c diff --git a/t/one.t b/t/one.t new file mode 100644 index 0000000..eddb112 --- /dev/null +++ b/t/one.t @@ -0,0 +1,54 @@ +use strict; +use warnings FATAL => 'all'; +use aliased 'MooseX::Antlers::EvalTracker'; +use aliased 'MooseX::Antlers::RefTracker'; +use aliased 'MooseX::Antlers::RefFilter'; +use B qw(perlstring); +use lib 't/lib'; +use Test::More; + +my %attr_refs; +my %attr_methods; + +{ + require Moose; + my $orig = Moose->can('import'); + no warnings 'redefine'; + local *Moose::import = sub { + my $targ = caller; + Moose->$orig({ into => $targ }); + my $has = $targ->can('has'); + { + no strict 'refs'; + *{"${targ}::has"} = sub { + $attr_refs{$_[0]} = RefTracker->trace_refs( + '$attributes{'.perlstring($_[0]).'}' + => \@_ + ); + my $et = EvalTracker->new->enable; + $has->(@_); + $attr_methods{$_[0]} = $et->recorded_coderefs; + }; + } + }; + require One; +} + +ok(One->can('foo'), 'foo accessor installed'); + +use Data::Dump::Streamer; + +my $orig_foo_src = Dump(One->can('foo')); + +# write test_class method that checks method including call +# Class::Unload One +# build compiled source +# eval compiled source +# run test_class after that as well as before unload + +use Data::Dumper::Concise; + +#warn Dumper \%attr_refs; +#warn Dumper \%attr_methods; + +done_testing;