summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-04 19:21:27 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-04 19:24:50 -0500
commit02a68abd6466029ea92d6160347e11f2b4d5d25a (patch)
tree0a7039bb36560573d70656e3b5782ffd860e639b /t
parentaabf883a41f3172275e1a05b10f872cfde5b94c5 (diff)
downloadtext-handlebars-02a68abd6466029ea92d6160347e11f2b4d5d25a.tar.gz
text-handlebars-02a68abd6466029ea92d6160347e11f2b4d5d25a.zip
allow [] for dereferencing with literals
Diffstat (limited to 't')
-rw-r--r--t/expressions.t24
1 files changed, 22 insertions, 2 deletions
diff --git a/t/expressions.t b/t/expressions.t
index f12022c..0026dbe 100644
--- a/t/expressions.t
+++ b/t/expressions.t
@@ -73,7 +73,28 @@ render_ok(
"backtracking into other hash variables with ../ and ."
);
-{ local $TODO = "unimplemented";
+render_ok(
+ '{{articles.[10].comments}}',
+ {
+ articles => {
+ 10 => { comments => "First post!" },
+ },
+ },
+ 'First post!',
+ "field access with non-identifiers"
+);
+
+render_ok(
+ '{{articles.[.foo\som#th"ing].comments}}',
+ {
+ articles => {
+ '.foo\som#th"ing' => { comments => "First post!" },
+ },
+ },
+ 'First post!',
+ "field access with non-identifiers"
+);
+
render_ok(
'{{articles.[10].comments}}',
{
@@ -85,7 +106,6 @@ render_ok(
'First post!',
"array dereferencing"
);
-}
render_ok(
'{{.}} {{this}}',