{{title}}
{{#noop}}{{body}}{{/noop}}
#!/usr/bin/env perl use strict; use warnings; use lib 't/lib'; use Test::More; use Test::Handlebars; render_ok( { helpers => { noop => sub { my ($context, $options) = @_; return $options->{fn}->($context); }, }, }, <<'TEMPLATE',
' . $options->{inverse}->($context) . '
'; } }, }, }, q[{{#list people}}{{name}}{{^}}Nobody's here{{/list}}], { people => [ { name => 'Alan' }, { name => 'Yehuda' }, ], }, q[' . $options->{inverse}->($context) . '
'; } }, }, }, q[{{#list people}}{{name}}{{^}}Nobody's here{{/list}}], { people => [], }, q[Nobody's here
], "helper with inverse (empty)" ); render_ok( { helpers => { list => sub { my ($context, $items, $options) = @_; if (@$items) { my $out = '' . $options->{inverse}->($context) . '
'; } }, }, }, q[{{#list people}}Hello{{^}}{{message}}{{/list}}], { people => [], message => "Nobody's here", }, q[Nobody's here
], "helper with inverse (inverse has variables)" ); done_testing;
{{subject}}
{{{body}}}