mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
dunnololtest
This commit is contained in:
@@ -143,7 +143,8 @@ module Liquid
|
||||
|
||||
# Fetches an object starting at the local scope and then moving up the hierachy
|
||||
def find_variable(key, raise_on_not_found: true)
|
||||
scope = @scope if @scope.key?(key)
|
||||
value = @scope[key]
|
||||
scope = @scope if value != nil
|
||||
|
||||
if scope.nil?
|
||||
index = @environments.find_index do |e|
|
||||
|
||||
@@ -368,6 +368,23 @@ HERE
|
||||
assert_template_result(expected, template, assigns)
|
||||
end
|
||||
|
||||
def test_overwriting_internal_variable
|
||||
template = <<-END_TEMPLATE
|
||||
{% assign forloop = 'first' %}
|
||||
|
||||
{% for item in items %}
|
||||
{{ forloop }}
|
||||
{% assign forloop = 'second' %}
|
||||
{{ forloop }}
|
||||
{% endfor %}
|
||||
|
||||
{{ forloop }}
|
||||
END_TEMPLATE
|
||||
|
||||
result = Liquid::Template.parse(template).render('items' => '1')
|
||||
assert_equal 'Liquid::ForloopDrop Liquid::ForloopDrop second', result.split.map(&:strip).join(' ')
|
||||
end
|
||||
|
||||
class LoaderDrop < Liquid::Drop
|
||||
attr_accessor :each_called, :load_slice_called
|
||||
|
||||
|
||||
Reference in New Issue
Block a user