Fixed using spaces in filter expressions and variables lists (#178)

* fixed using spaces in filter expression

* fixed breaking variables lists and filters by spaces

* simplified smartJoin

* avoid force unwrap
This commit is contained in:
Ilya Puchka
2018-05-13 01:06:38 +01:00
committed by GitHub
parent d935f65d56
commit 39ed9aa753
6 changed files with 32 additions and 11 deletions

View File

@@ -78,9 +78,9 @@ func testFilter() {
}
$0.it("allows whitespace in expression") {
let template = Template(templateString: "{{ name | uppercase }}")
let result = try template.render(Context(dictionary: ["name": "kyle"]))
try expect(result) == "KYLE"
let template = Template(templateString: "{{ value | join : \", \" }}")
let result = try template.render(Context(dictionary: ["value": ["One", "Two"]]))
try expect(result) == "One, Two"
}
$0.it("throws when you pass arguments to simple filter") {