mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 09:20:42 -07:00
Merge pull request #540 from Shopify/array-concat
Add array concat filter
This commit is contained in:
@@ -359,6 +359,17 @@ class StandardFiltersTest < Minitest::Test
|
||||
assert_template_result('bcd',"{{ a | append: b}}",assigns)
|
||||
end
|
||||
|
||||
def test_concat
|
||||
assert_equal [1, 2, 3, 4], @filters.concat([1, 2], [3, 4])
|
||||
assert_equal [1, 2, 'a'], @filters.concat([1, 2], ['a'])
|
||||
assert_equal [1, 2, 10], @filters.concat([1, 2], [10])
|
||||
|
||||
assert_raises(TypeError) do
|
||||
# no implicit conversion of Fixnum into Array
|
||||
@filters.concat([1, 2], 10)
|
||||
end
|
||||
end
|
||||
|
||||
def test_prepend
|
||||
assigns = {'a' => 'bc', 'b' => 'a' }
|
||||
assert_template_result('abc',"{{ a | prepend: 'a'}}",assigns)
|
||||
|
||||
Reference in New Issue
Block a user