Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert always throws #300

Open
openstrike opened this issue Sep 16, 2022 · 0 comments
Open

Assert always throws #300

openstrike opened this issue Sep 16, 2022 · 0 comments

Comments

@openstrike
Copy link

I've been trying to use Template::Plugin::Assert without success - perhaps I am just misunderstading something fundamental. Here is my trivial test script.

use strict;
use warnings;

use Template;
use Test::More tests => 1;

my $template = Template->new ();

my $v = { foo => { bar => 999 } };

my $tsrc = <<EOT;
[% USE assert %]
[% foo.assert.bar %]
EOT

ok $template->process (\$tsrc, $v), 'Assert passes' or
    diag $template->error ();

I expect this to pass but it fails with assert error - undefined value for bar.

It appears that the test script shipped with the dist only tests for the cases when assert should throw. It never tests the case when assert should pass.

What am I missing here?

Tested on perl 5.34.0, Template version 3.010.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant