-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Whitespace control (https://shopify.github.io/liquid/basics/whitespace/)
Thanks you @ailin-nemui for the issue #6 kick in the pants
- Loading branch information
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use strict; | ||
use warnings; | ||
use lib qw[../../lib ../../blib/lib]; | ||
use Test::More; # Requires 0.94 as noted in Build.PL | ||
use Template::Liquid; | ||
$|++; | ||
is( Template::Liquid->parse( | ||
<<'TEMPLATE')->render(), ' Wow, John G. Chalmers-Smith, you have a long name!', 'whitespace control'); | ||
{%- assign username = "John G. Chalmers-Smith" -%} | ||
{%- if username and username.size > 10 -%} | ||
Wow, {{ username }}, you have a long name! | ||
{%- else -%} | ||
Hello there! | ||
{%- endif -%} | ||
TEMPLATE | ||
is( Template::Liquid->parse( | ||
<<'TEMPLATE')->render(), <<'EXPECTED', 'without whitespace control'); | ||
{% assign username = "John G. Chalmers-Smith" %} | ||
{% if username and username.size > 10 %} | ||
Wow, {{ username }}, you have a long name! | ||
{% else %} | ||
Hello there! | ||
{% endif %} | ||
TEMPLATE | ||
|
||
|
||
Wow, John G. Chalmers-Smith, you have a long name! | ||
|
||
EXPECTED | ||
is( Template::Liquid->parse( | ||
<<'TEMPLATE')->render(), <<'EXPECTED', 'mixed with and without whitespace control'); | ||
{%-assign username = "John G. Chalmers-Smith"-%} | ||
{%-if username and username.size > 10 %} | ||
Wow, {{ username }}, you have a long name! | ||
{%else%} | ||
Hello there! | ||
{%endif-%} | ||
TEMPLATE | ||
|
||
Wow, John G. Chalmers-Smith, you have a long name! | ||
EXPECTED | ||
done_testing(); |