mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-18 10:20:43 -07:00
Ensure that partial caches are shared with subcontexts
Make Context use StaticRegisters by default. This makes it easier to ensure that all subcontexts share the same static registers. Co-authored-by: Dylan Thacker-Smith <[email protected]>
This commit is contained in:
co-authored by
Dylan Thacker-Smith
parent
1cae1e497f
commit
6c2c621712
@@ -618,6 +618,20 @@ class ContextTest < Minitest::Test
|
||||
end
|
||||
end
|
||||
|
||||
def test_context_always_uses_static_registers
|
||||
registers = {
|
||||
my_register: :my_value,
|
||||
}
|
||||
c = Context.new({}, {}, registers)
|
||||
assert_instance_of(StaticRegisters, c.registers)
|
||||
assert_equal(:my_value, c.registers[:my_register])
|
||||
|
||||
r = StaticRegisters.new(registers)
|
||||
c = Context.new({}, {}, r)
|
||||
assert_instance_of(StaticRegisters, c.registers)
|
||||
assert_equal(:my_value, c.registers[:my_register])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def assert_no_object_allocations
|
||||
|
||||
Reference in New Issue
Block a user