Tests
Test: ends-with
Template
{% if 'Templates' ends with 's' %}
"Templates" ends with "s"
{% endif %}
Output Django (error) v1.10.1
Unused 'ends' at end of if expression.
Output Jinja2 (error) v2.8.0
expected token 'end of statement block', got 'ends'
Output Liquid (error) v3.0.6
Liquid error: Unknown operator ends
Output Nunjucks (error) v2.5.0
[Line 1, Column 22]
expected block end in if statement
Output Swig (error) v1.4.2
Reserved keyword "with" attempted to be used as a variable.
Output Twig v1.24.2
"Templates" ends with "s"
Output Twigjs (error) v0.9.5
TypeError: Cannot read property 'forEach' of undefined
Test: equal-to
Template
{% if varX == varY %}
`varX` is equal to `varY`
{% endif %}
Data
{
"varX": "Templates",
"varY": "Templates"
}
Output Django v1.10.1
`varX` is equal to `varY`
Output Jinja2 v2.8.0
`varX` is equal to `varY`
Output Liquid v3.0.6
`varX` is equal to `varY`
Output Nunjucks v2.5.0
`varX` is equal to `varY`
Output Swig v1.4.2
`varX` is equal to `varY`
Output Twig v1.24.2
`varX` is equal to `varY`
Output Twigjs v0.9.5
`varX` is equal to `varY`
Test: greater-than-or-equal
Template
{% if 2 >= 1 %}
2 is greater than or equal to 1
{% endif %}
{% if 2 >= 1 %}
2 is greater than or equal to 2
{% endif %}
Output Django v1.10.1
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Jinja2 v2.8.0
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Liquid v3.0.6
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Nunjucks v2.5.0
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Swig v1.4.2
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Twig v1.24.2
2 is greater than or equal to 1
2 is greater than or equal to 2
Output Twigjs v0.9.5
2 is greater than or equal to 1
2 is greater than or equal to 2
Test: greater-than
Template
{% if 2 > 1 %}
2 is greater than 1
{% endif %}
Output Django v1.10.1
2 is greater than 1
Output Jinja2 v2.8.0
2 is greater than 1
Output Liquid v3.0.6
2 is greater than 1
Output Nunjucks v2.5.0
2 is greater than 1
Output Swig v1.4.2
2 is greater than 1
Output Twig v1.24.2
2 is greater than 1
Output Twigjs v0.9.5
2 is greater than 1
Test: less-than-or-equal
Template
{% if 1 <= 2 %}
1 is less than or equal to 2
{% endif %}
{% if 1 <= 1 %}
1 is less than or equal to 1
{% endif %}
Output Django v1.10.1
1 is less than or equal to 2
1 is less than or equal to 1
Output Jinja2 v2.8.0
1 is less than or equal to 2
1 is less than or equal to 1
Output Liquid v3.0.6
1 is less than or equal to 2
1 is less than or equal to 1
Output Nunjucks v2.5.0
1 is less than or equal to 2
1 is less than or equal to 1
Output Swig v1.4.2
1 is less than or equal to 2
1 is less than or equal to 1
Output Twig v1.24.2
1 is less than or equal to 2
1 is less than or equal to 1
Output Twigjs v0.9.5
1 is less than or equal to 2
1 is less than or equal to 1
Test: less-than
Template
{% if 1 < 2 %}
1 is less than 2
{% endif %}
Output Django v1.10.1
1 is less than 2
Output Jinja2 v2.8.0
1 is less than 2
Output Liquid v3.0.6
1 is less than 2
Output Nunjucks v2.5.0
1 is less than 2
Output Swig v1.4.2
1 is less than 2
Output Twig v1.24.2
1 is less than 2
Output Twigjs v0.9.5
1 is less than 2
Test: matches
Template
{% if phone matches '/^[\\d\\.]+$/' %}
`phone` is a valid phone number
{% endif %}
Data
{
"phone": "00311234567"
}
Output Django (error) v1.10.1
Unused 'matches' at end of if expression.
Output Jinja2 (error) v2.8.0
expected token 'end of statement block', got 'matches'
Output Liquid (error) v3.0.6
Liquid error: Unknown operator matches
Output Nunjucks (error) v2.5.0
[Line 1, Column 19]
expected block end in if statement
Output Swig (error) v1.4.2
SyntaxError: Unexpected string.
Output Twig v1.24.2
`phone` is a valid phone number
Output Twigjs (error) v0.9.5
TypeError: Cannot read property 'forEach' of undefined
Test: not-equal-to
Template
{% if varX != varY %}
`varX` is not equal to `varY`
{% endif %}
Data
{
"varX": "Templates",
"varY": "Partials"
}
Output Django v1.10.1
`varX` is not equal to `varY`
Output Jinja2 v2.8.0
`varX` is not equal to `varY`
Output Liquid v3.0.6
`varX` is not equal to `varY`
Output Nunjucks v2.5.0
`varX` is not equal to `varY`
Output Swig v1.4.2
`varX` is not equal to `varY`
Output Twig v1.24.2
`varX` is not equal to `varY`
Output Twigjs v0.9.5
`varX` is not equal to `varY`
Test: starts-with
Template
{% if 'Templates' starts with 'T' %}
"Templates" starts with "T"
{% endif %}
Output Django (error) v1.10.1
Unused 'starts' at end of if expression.
Output Jinja2 (error) v2.8.0
expected token 'end of statement block', got 'starts'
Output Liquid (error) v3.0.6
Liquid error: Unknown operator starts
Output Nunjucks (error) v2.5.0
[Line 1, Column 24]
expected block end in if statement
Output Swig (error) v1.4.2
Reserved keyword "with" attempted to be used as a variable.
Output Twig v1.24.2
"Templates" starts with "T"
Output Twigjs (error) v0.9.5
TypeError: Cannot read property 'forEach' of undefined
Test: strict-equal-to
Template
{% if 1234 === 1234 %}
1234 not strict equal to 1234
{% endif %}
Output Django (error) v1.10.1
Could not parse the remainder: '===' from '==='
Output Jinja2 (error) v2.8.0
unexpected '='
Output Liquid (error) v3.0.6
Liquid error: Unknown operator ===
Output Nunjucks v2.5.0
1234 not strict equal to 1234
Output Swig v1.4.2
1234 not strict equal to 1234
Output Twig (error) v1.24.2
Unexpected token "operator" of value "=".
Output Twigjs (error) v0.9.5
TypeError: Cannot read property 'forEach' of undefined
Test: strict-not-equal-to
Template
{% if 1234 !== '1234' %}
1234 is not strict equal to '1234'
{% endif %}
Output Django (error) v1.10.1
Could not parse the remainder: '!==' from '!=='
Output Jinja2 (error) v2.8.0
unexpected '='
Output Liquid (error) v3.0.6
Liquid error: Unknown operator !==
Output Nunjucks v2.5.0
1234 is not strict equal to '1234'
Output Swig v1.4.2
1234 is not strict equal to '1234'
Output Twig (error) v1.24.2
Unexpected token "operator" of value "=".
Output Twigjs (error) v0.9.5
TypeError: Cannot read property 'forEach' of undefined