mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 16:55:40 +03:00
Make sure include tags are never blank
This commit is contained in:
@@ -38,6 +38,10 @@ module Liquid
|
||||
def parse(tokens)
|
||||
end
|
||||
|
||||
def blank?
|
||||
false
|
||||
end
|
||||
|
||||
def render(context)
|
||||
partial = load_cached_partial(context)
|
||||
variable = context[@variable_name || @template_name[1..-2]]
|
||||
|
||||
@@ -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