mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.48k stars 635 forks source link

Jinja-style tests don't work without parentheses #1396

Open anthmatic opened 2 years ago

anthmatic commented 2 years ago

Jinja style tests were added in https://github.com/mozilla/nunjucks/pull/1033 but it looks like they're only supported with parentheses. This is inconsistent with Jinja, which says:

Tests can accept arguments, too. If the test only takes one argument, you can leave out the parentheses.

Not working:

if x is equalto 1

Working:

if x is equalto(1)

This is not an issue for tests with no args, which work fine:

if x is defined