Revision: 1374 Author: [email protected] Date: Thu Sep 30 03:18:37 2010 Log: Add preliminary (incomplete) test files for #line handling and Moose.
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1374 Added: /trunk/t/68-hashline.t /trunk/t/71-moose.t Modified: /trunk/MANIFEST ======================================= --- /dev/null +++ /trunk/t/68-hashline.t Thu Sep 30 03:18:37 2010 @@ -0,0 +1,48 @@ +# Tests CORE::GLOBAL::foo plus assorted data model methods + +use strict; +use Test::More; + +use lib qw(t/lib); +use NYTProfTest; + +use Devel::NYTProf::Run qw(profile_this); + +warn "Incomplete test"; + +my $src_code = join("", <DATA>); + +run_test_group( { + extra_options => { + start => 'begin', compress => 1, stmts => 1, slowops => 0, + }, + extra_test_count => 2, + extra_test_code => sub { + my ($profile, $env) = @_; + + $profile = profile_this( + src_code => $src_code, + out_file => $env->{file}, + skip_sitecustomize => 1, + #htmlopen => 1, + ); + isa_ok $profile, 'Devel::NYTProf::Data'; + + my $subs = $profile->subname_subinfo_map; + + ok 1; + }, +}); + +__DATA__ +sub a { 0 } +#line 101 "hash-line-first" +sub b { 1 } +#line 202 "hash-line-second" +sub c { 2 } +eval qq{#line 303 "hash-line-eval" +sub d { 3 } +1} or die; +a(); b(); c(); d(); +print "File: $_\n" for sort grep { m/_</ } keys %{'main::'}; +print "Sub: $_ => $DB::sub{$_}\n" for sort keys %DB::sub; ======================================= --- /dev/null +++ /trunk/t/71-moose.t Thu Sep 30 03:18:37 2010 @@ -0,0 +1,54 @@ +# Tests CORE::GLOBAL::foo plus assorted data model methods + +use strict; +use Test::More; + +use lib qw(t/lib); +use NYTProfTest; + +eval "use Moose 1.14; 1" + or plan skip_all => "Moose 1.14 required"; + +print "Moose $Moose::VERSION $INC{'Moose.pm'}\n"; + +plan skip_all => "Currently a developer-only test" unless -d '.svn'; + +warn "Incomplete test"; + +use Devel::NYTProf::Run qw(profile_this); + +my $src_code = join("", <DATA>); + +run_test_group( { + extra_options => { + start => 'begin', compress => 1, stmts => 0, slowops => 0, + }, + extra_test_count => 2, + extra_test_code => sub { + my ($profile, $env) = @_; + + $profile = profile_this( + src_code => $src_code, + out_file => $env->{file}, + skip_sitecustomize => 1, + #htmlopen => 1, + ); + isa_ok $profile, 'Devel::NYTProf::Data'; + + my $subs = $profile->subname_subinfo_map; + + ok 1; + }, +}); + +__DATA__ +#!perl +package P; +use Moose; +has attrib_std => ( is => 'rw', default => 42 ); +has attrib_lazy => ( is => 'rw', lazy => 1, default => sub { 43 } ); +END { + my $p = P->new; + $p->attrib_std; + $p->attrib_lazy +} ======================================= --- /trunk/MANIFEST Thu Jun 17 02:00:03 2010 +++ /trunk/MANIFEST Thu Sep 30 03:18:37 2010 @@ -61,7 +61,9 @@ t/50-errno.t t/60-forkdepth.t t/61-cputime.t +t/68-hashline.t t/70-subname.t +t/71-moose.t t/80-version.t t/90-pod.t t/91-pod_coverage.t -- You've received this message because you are subscribed to the Devel::NYTProf Development User group. Group hosted at: http://groups.google.com/group/develnytprof-dev Project hosted at: http://perl-devel-nytprof.googlecode.com CPAN distribution: http://search.cpan.org/dist/Devel-NYTProf To post, email: [email protected] To unsubscribe, email: [email protected]
