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) Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests of templates! Devel::Cover::TT 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, }, ], }; 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 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 > 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