<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -40,6 +40,28 @@ class CategoryDrop
   end
 end
 
+class CounterDrop &lt; Liquid::Drop
+  def count
+    @count ||= 0
+    @count += 1
+  end
+end
+
+class ArrayLike
+  def fetch(index)
+  end
+
+  def [](index)
+    @counts ||= []
+    @counts[index] ||= 0
+    @counts[index] += 1
+  end
+
+  def to_liquid
+    self
+  end
+end
+
 
 class ContextTest &lt; Test::Unit::TestCase
   include Liquid
@@ -299,6 +321,14 @@ class ContextTest &lt; Test::Unit::TestCase
     assert_equal 'freestyle', @context['products[nested.var].last']
   end
 
+  def test_hash_notation_only_for_hash_access
+    @context['array'] = [1,2,3,4,5]
+    @context['hash'] = {'first' =&gt; 'Hello'}
+
+    assert_equal 1, @context['array.first']
+    assert_equal nil, @context['array[&quot;first&quot;]']
+    assert_equal 'Hello', @context['hash[&quot;first&quot;]']
+  end
 
   def test_first_can_appear_in_middle_of_callchain
 
@@ -364,6 +394,22 @@ class ContextTest &lt; Test::Unit::TestCase
     assert_equal 100, @context['cents.cents.cents.amount']
   end
 
+  def test_drop_with_variable_called_only_once
+    @context['counter'] = CounterDrop.new
+
+    assert_equal 1, @context['counter.count']
+    assert_equal 2, @context['counter.count']
+    assert_equal 3, @context['counter.count']
+  end
+
+  def test_drop_with_key_called_only_once
+    @context['counter'] = CounterDrop.new
+
+    assert_equal 1, @context['counter[&quot;count&quot;]']
+    assert_equal 2, @context['counter[&quot;count&quot;]']
+    assert_equal 3, @context['counter[&quot;count&quot;]']
+  end
+
   def test_proc_as_variable
     @context['dynamic'] = Proc.new { 'Hello' }
 
@@ -382,6 +428,12 @@ class ContextTest &lt; Test::Unit::TestCase
     assert_equal 'Hello', @context['dynamic.lambda']
   end
 
+  def test_array_containing_lambda_as_variable
+    @context['dynamic'] = [1,2, lambda { 'Hello' } ,4,5]
+
+    assert_equal 'Hello', @context['dynamic[2]']
+  end
+
   def test_lambda_is_called_once
     @context['callcount'] = lambda { @global ||= 0; @global += 1; @global.to_s }
 
@@ -402,6 +454,16 @@ class ContextTest &lt; Test::Unit::TestCase
     @global = nil
   end
 
+  def test_lambda_in_array_is_called_once
+    @context['callcount'] = [1,2, lambda { @global ||= 0; @global += 1; @global.to_s } ,4,5]
+
+    assert_equal '1', @context['callcount[2]']
+    assert_equal '1', @context['callcount[2]']
+    assert_equal '1', @context['callcount[2]']
+
+    @global = nil
+  end
+
   def test_access_to_context_from_proc
     @context.registers[:magic] = 345392
 </diff>
      <filename>test/context_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>819b70204fb692223a34c914881ca3d757767a8e</id>
    </parent>
  </parents>
  <author>
    <name>Mark H. Wilkinson</name>
    <email>mhw@dangerous-techniques.com</email>
  </author>
  <url>http://github.com/tobi/liquid/commit/50edd0f5b92cc38f7da032fc0caea6dbdadd9f07</url>
  <id>50edd0f5b92cc38f7da032fc0caea6dbdadd9f07</id>
  <committed-date>2008-07-09T10:46:38-07:00</committed-date>
  <authored-date>2008-07-08T09:35:36-07:00</authored-date>
  <message>Add some failing tests for Context.

Using an attribute should only cause the corresponding method to be invoked
once. Replacing a lambda with its return value should work for arrays.
Array index syntax shouldn't allow calls to special methods.</message>
  <tree>794746d7bc4c9ae42ebb85452323a90db324ec4c</tree>
  <committer>
    <name>Mark H. Wilkinson</name>
    <email>mhw@dangerous-techniques.com</email>
  </committer>
</commit>
