1 / 4

David Westbrook (davidrw) dwestbrook@gmail

2008-06-18 davidrw. Devel::Cover::TT. David Westbrook (davidrw) dwestbrook@gmail.com. Combining Devel::Cover and Template-Toolkit for coverage stats on templates. Evaluate direct unit tests of templates!. 2008-06-18 davidrw. Initial Coverage Example. { title => 'Test1',

kelvin
Télécharger la présentation

David Westbrook (davidrw) dwestbrook@gmail

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 2008-06-18 davidrw Initial Coverage Example { title => 'Test1', verbose => 0, rows => [ { x => 1, y => 2, }, { x => 2, y => 4, }, ], }; [% 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 %]

  3. 2008-06-18 davidrw Concepts & Methodology • 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 Interface use Devel::Cover::TT qw{ -silent 1 -ignore . }; # Devel::Cover::TT::* Provider, Document 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(); }

  4. 2008-06-18 davidrw 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

More Related