Skip to content

Commit

Permalink
Add tests for $idx and $len when iteration object contains simple val…
Browse files Browse the repository at this point in the history
…ues and not objects. This did not work with the previous way $idx/$len was implemented. All array objects should support $idx/$len now
  • Loading branch information
rragan committed Aug 15, 2012
1 parent e42ff4d commit 4606d03
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/jasmine-test/spec/grammarTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ var grammarTests = [
expected: "Size=(3).Sir Moe\nSize=(3).Sir Larry\nSize=(3).Sir Curly\n",
message: "should test an array"
},
{
name: "array",
source: "{#names}({$idx}).{title} {.}{~n}{/names}",
context: { title: "Sir", names: [ "Moe", "Larry", "Curly" ] },
expected: "(0).Sir Moe\n(1).Sir Larry\n(2).Sir Curly\n",
message: "should test an array with non-object elements using $idx"
},
{
name: "array",
source: "{#names}Size=({$len}).{title} {.}{~n}{/names}",
context: { title: "Sir", names: [ "Moe", "Larry", "Curly" ] },
expected: "Size=(3).Sir Moe\nSize=(3).Sir Larry\nSize=(3).Sir Curly\n",
message: "should test an array with non-object elements using $len"
},
{
name: "empty_array",
source: "{#names}{title} {name}{~n}{/names}",
Expand Down

0 comments on commit 4606d03

Please sign in to comment.