| File: | t/module.t |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | 1 1 1 | 10334 11 39 | use strict; | ||||
| 2 | 1 1 1 | 113 6 41 | use warnings; | ||||
| 3 | |||||||
| 4 | 1 1 1 | 554 51264 1014 | use Test::Most; | ||||
| 5 | 1 1 1 | 83545 391277 17 | use Test::Mojo; | ||||
| 6 | 1 1 1 | 150 134362 11123 | use Mojolicious::Lite; | ||||
| 7 | |||||||
| 8 | plugin ToolkitRenderer => { | ||||||
| 9 | settings => { | ||||||
| 10 | inline_template => 'inline', | ||||||
| 11 | controller => 'c', | ||||||
| 12 | }, | ||||||
| 13 | config => { | ||||||
| 14 | RELATIVE => 1, | ||||||
| 15 | EVAL_PERL => 0, | ||||||
| 16 | 1 | 52413 | FILTERS => { upper => sub { return uc shift } }, | ||||
| 17 | }, | ||||||
| 18 | 1 1 | 5704 48 | context => sub { shift->define_vmethod( 'scalar', 'upper', sub { return uc shift } ) }, | ||||
| 19 | 1 | 249555 | }; | ||||
| 20 | |||||||
| 21 | get '/simple' => sub { | ||||||
| 22 | 1 | 12333 | my ($self) = @_; | ||||
| 23 | |||||||
| 24 | 1 | 14 | $self->render_tt( | ||||
| 25 | inline => 'The answer to life, the [% universe | upper %], and [% everything.upper %] is [% answer %].', | ||||||
| 26 | answer => 42, everything => 'everything', universe => 'universe', | ||||||
| 27 | ); | ||||||
| 28 | 1 | 39 | }; | ||||
| 29 | |||||||
| 30 | 1 | 315 | my $t = Test::Mojo->new; | ||||
| 31 | |||||||
| 32 | 1 | 23 | $t | ||||
| 33 | ->get_ok('/simple') | ||||||
| 34 | ->status_is(200) | ||||||
| 35 | ->content_is('The answer to life, the UNIVERSE, and EVERYTHING is 42.') | ||||||
| 36 | ; | ||||||
| 37 | |||||||
| 38 | 1 | 271 | done_testing; | ||||