Presentation is loading. Please wait.

Presentation is loading. Please wait.

David Westbrook (davidrw) Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests.

Similar presentations


Presentation on theme: "David Westbrook (davidrw) Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests."— Presentation transcript:

1 David Westbrook (davidrw) dwestbrook@gmail.com Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests of templates! Devel::Cover::TT 2008-06-18 davidrw

2 [% title %][% ' - ' _ subtitle IF subtitle %] ~~~~ [% PROCESS show_rows IF verbose && rows.size > 0 %] ~~~~ [% BLOCK show_rows %] [% FOREACH row = rows -%] [% row.x %] / [% row.y %] = [% row.y == 0 ? 'N/A' : ( row.x / row.y ) %] [% END -%] [% END %] Initial Coverage Example { title => 'Test1', verbose => 0, rows => [ { x => 1, y => 2, }, { x => 2, y => 4, }, ], }; 2008-06-18 davidrw

3 Concepts & Methodology Approach BEFORE Cache file contents: Template::Document->new(.... ); To read from cache: $foo = require $cachefile AFTER Cache file contents: package path::to:tmpl::example_tmpl.pm; sub getDocument { Template::Document->new(.... ); } 1; To read from cache: eval { use path::to:tmpl::example_tmpl; $foo = path::to:tmpl::example_tmpl->getDocument(); } Interface use Devel::Cover::TT qw{ -silent 1 -ignore. }; # Devel::Cover::TT::* Provider, Document  Key Concepts Coverage of TT templates Unit tests on TT templates  Issues Coverage of.ttc, not tmpl itself Uncoverable TT-generated code  TODO Gather Feedback! Review & test TT hooks, overloads, subclassing Ensure robustness over hacks 2008-06-18 davidrw

4 Analysis & Improved Coverage! { title => 'Test2', subtitle => 'second test', verbose => 1, rows => [ { x => 1, y => 2, }, { x => 3, y => 0, }, { x => 2, y => 4, }, ], }; && rows.size > 0 2008-06-18 davidrw


Download ppt "David Westbrook (davidrw) Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests."

Similar presentations


Ads by Google