mirror of
https://github.com/kemko/liquid.git
synced 2026-01-05 01:35:41 +03:00
Make sure include tags are never blank
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
require 'test_helper'
|
||||
|
||||
class BlankTestFileSystem
|
||||
def read_template_file(template_path, context)
|
||||
template_path
|
||||
end
|
||||
end
|
||||
|
||||
class BlankTest < Test::Unit::TestCase
|
||||
include Liquid
|
||||
N = 10
|
||||
@@ -77,4 +83,11 @@ class BlankTest < Test::Unit::TestCase
|
||||
assert_template_result(" "*(N+1), wrap(' {{ "" }} '))
|
||||
assert_template_result(" "*(N+1), wrap("{% assign foo = ' ' %}{{ foo }}"))
|
||||
end
|
||||
|
||||
def test_include_is_blank
|
||||
Liquid::Template.file_system = BlankTestFileSystem.new
|
||||
assert_equal "foobar"*(N+1), Template.parse(wrap("{% include 'foobar' %}")).render()
|
||||
assert_equal " foobar "*(N+1), Template.parse(wrap("{% include ' foobar ' %}")).render()
|
||||
assert_equal " ", Template.parse(" {% include ' ' %} ").render()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user