-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: restructure tests, add more test from handlebars-php
- Loading branch information
1 parent
f1fdb35
commit 353d8bf
Showing
4 changed files
with
326 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
[ | ||
[ | ||
"{{! This is comment}}", | ||
[], | ||
"" | ||
], | ||
[ | ||
"{{data}}", | ||
{ | ||
{ | ||
"template": "{{! This is comment}}", | ||
"data":[], | ||
"result":"" | ||
}, | ||
{ | ||
"template": "{{data}}", | ||
"data":{ | ||
"data": "result" | ||
}, | ||
"result" | ||
], | ||
[ | ||
"{{data.key}}", | ||
{ | ||
"result":"result" | ||
}, | ||
{ | ||
"template": "{{data.key}}", | ||
"data":{ | ||
"data": { | ||
"key": "result" | ||
} | ||
}, | ||
"result" | ||
] | ||
"result":"result" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,276 @@ | ||
[ | ||
{ | ||
"template": "{{#each data}}{{@index}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
"result": "0123" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@key}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
|
||
"result": "0123" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{#each this}}outer: {{@../key}},inner: {{@key}};{{/each}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
[ | ||
"apple", | ||
"banana" | ||
], | ||
[ | ||
"carrot", | ||
"zucchini" | ||
] | ||
] | ||
}, | ||
"result": "outer: 0,inner: 0;outer: 0,inner: 1;outer: 1,inner: 0;outer: 1,inner: 1;" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{#if @first}}true{{else}}false{{/if}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
"result": "truefalsefalsefalse" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@first}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
|
||
"result": "truefalsefalsefalse" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{#each this}}outer: {{@../first}},inner: {{@first}};{{/each}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
[ | ||
"apple", | ||
"banana" | ||
], | ||
[ | ||
"carrot", | ||
"zucchini" | ||
] | ||
] | ||
}, | ||
"result": "outer: true,inner: true;outer: true,inner: false;outer: false,inner: true;outer: false,inner: false;" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{#if @last}}true{{else}}false{{/if}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
"result": "falsefalsefalsetrue" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@last}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
"apple", | ||
"banana", | ||
"carrot", | ||
"zucchini" | ||
] | ||
}, | ||
|
||
"result": "falsefalsefalsetrue" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{#each this}}outer: {{@../last}},inner: {{@last}};{{/each}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
[ | ||
"apple", | ||
"banana" | ||
], | ||
[ | ||
"carrot", | ||
"zucchini" | ||
] | ||
] | ||
}, | ||
"result": "outer: false,inner: false;outer: false,inner: true;outer: true,inner: false;outer: true,inner: true;" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@index}}{{/each}}", | ||
"data": { | ||
"data": [ | ||
{ | ||
"@index": "apple" | ||
}, | ||
{ | ||
"@index": "banana" | ||
}, | ||
{ | ||
"@index": "carrot" | ||
}, | ||
{ | ||
"@index": "zucchini" | ||
} | ||
] | ||
}, | ||
"result": "0123" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@index}}{{/each}}", | ||
"data": { | ||
"data": [{ | ||
"@index": "apple", | ||
"@first": "apple", | ||
"@last": "apple", | ||
"@unknown": "apple" | ||
}, | ||
{ | ||
"@index": "banana", | ||
"@first": "banana", | ||
"@last": "banana", | ||
"@unknown": "banana" | ||
}, | ||
{ | ||
"@index": "carrot", | ||
"@first": "carrot", | ||
"@last": "carrot", | ||
"@unknown": "carrot" | ||
}, | ||
{ | ||
"@index": "zucchini", | ||
"@first": "zucchini", | ||
"@last": "zucchini", | ||
"@unknown": "zucchini" | ||
}] | ||
}, | ||
"result": "0123" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@first}}{{/each}}", | ||
"data": { | ||
"data": [{ | ||
"@index": "apple", | ||
"@first": "apple", | ||
"@last": "apple", | ||
"@unknown": "apple" | ||
}, | ||
{ | ||
"@index": "banana", | ||
"@first": "banana", | ||
"@last": "banana", | ||
"@unknown": "banana" | ||
}, | ||
{ | ||
"@index": "carrot", | ||
"@first": "carrot", | ||
"@last": "carrot", | ||
"@unknown": "carrot" | ||
}, | ||
{ | ||
"@index": "zucchini", | ||
"@first": "zucchini", | ||
"@last": "zucchini", | ||
"@unknown": "zucchini" | ||
}] | ||
}, | ||
"result": "truefalsefalsefalse" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@last}}{{/each}}", | ||
"data": { | ||
"data": [{ | ||
"@index": "apple", | ||
"@first": "apple", | ||
"@last": "apple", | ||
"@unknown": "apple" | ||
}, | ||
{ | ||
"@index": "banana", | ||
"@first": "banana", | ||
"@last": "banana", | ||
"@unknown": "banana" | ||
}, | ||
{ | ||
"@index": "carrot", | ||
"@first": "carrot", | ||
"@last": "carrot", | ||
"@unknown": "carrot" | ||
}, | ||
{ | ||
"@index": "zucchini", | ||
"@first": "zucchini", | ||
"@last": "zucchini", | ||
"@unknown": "zucchini" | ||
}] | ||
}, | ||
"result": "falsefalsefalsetrue" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@unknown}}{{/each}}", | ||
"data": { | ||
"data": [{ | ||
"@index": "apple", | ||
"@first": "apple", | ||
"@last": "apple", | ||
"@unknown": "apple" | ||
}, | ||
{ | ||
"@index": "banana", | ||
"@first": "banana", | ||
"@last": "banana", | ||
"@unknown": "banana" | ||
}, | ||
{ | ||
"@index": "carrot", | ||
"@first": "carrot", | ||
"@last": "carrot", | ||
"@unknown": "carrot" | ||
}, | ||
{ | ||
"@index": "zucchini", | ||
"@first": "zucchini", | ||
"@last": "zucchini", | ||
"@unknown": "zucchini" | ||
}] | ||
}, | ||
"result": "" | ||
}, | ||
{ | ||
"template": "{{#each data}}{{@key}}{{/each}}", | ||
"data": { | ||
"data": { | ||
"fruit": "apple", | ||
"19": "banana", | ||
"true": "carrot" | ||
} | ||
}, | ||
"result": "fruit19true" | ||
} | ||
] |
Oops, something went wrong.