Yaffs site version 1.1
[yaffs-website] / vendor / twig / twig / test / Twig / Tests / Fixtures / tags / for / loop_context.test
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test
new file mode 100644 (file)
index 0000000..93bc76a
--- /dev/null
@@ -0,0 +1,19 @@
+--TEST--
+"for" tag adds a loop variable to the context
+--TEMPLATE--
+{% for item in items %}
+  * {{ loop.index }}/{{ loop.index0 }}
+  * {{ loop.revindex }}/{{ loop.revindex0 }}
+  * {{ loop.first }}/{{ loop.last }}/{{ loop.length }}
+
+{% endfor %}
+--DATA--
+return array('items' => array('a', 'b'))
+--EXPECT--
+  * 1/0
+  * 2/1
+  * 1//2
+
+  * 2/1
+  * 1/0
+  * /1/2