mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 16:25:42 +03:00
This makes it easier to re-use the integration tests in a seperate gem that optimizes parts of liquid with a native implementation.
28 lines
851 B
Ruby
28 lines
851 B
Ruby
require 'test_helper'
|
|
|
|
class AssignTest < Test::Unit::TestCase
|
|
include Liquid
|
|
|
|
def test_assigned_variable
|
|
assert_template_result('.foo.',
|
|
'{% assign foo = values %}.{{ foo[0] }}.',
|
|
'values' => %w{foo bar baz})
|
|
|
|
assert_template_result('.bar.',
|
|
'{% assign foo = values %}.{{ foo[1] }}.',
|
|
'values' => %w{foo bar baz})
|
|
end
|
|
|
|
def test_assign_with_filter
|
|
assert_template_result('.bar.',
|
|
'{% assign foo = values | split: "," %}.{{ foo[1] }}.',
|
|
'values' => "foo,bar,baz")
|
|
end
|
|
|
|
def test_assign_syntax_error
|
|
assert_match_syntax_error(/assign/,
|
|
'{% assign foo not values %}.',
|
|
'values' => "foo,bar,baz")
|
|
end
|
|
end # AssignTest
|