mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Cache parsed markup parts to avoid repeated calls during template render
This commit is contained in:
@@ -473,4 +473,14 @@ class ContextUnitTest < Test::Unit::TestCase
|
||||
assert mock_empty.has_been_called?
|
||||
end
|
||||
|
||||
def test_variable_lookup_caches_markup
|
||||
mock_scan = Spy.on_instance_method(String, :scan).and_return(["string"])
|
||||
|
||||
@context['string'] = 'string'
|
||||
@context['string']
|
||||
@context['string']
|
||||
|
||||
assert_equal 1, mock_scan.calls.size
|
||||
end
|
||||
|
||||
end # ContextTest
|
||||
|
||||
Reference in New Issue
Block a user