Add transforms empty() and equalzero()
This commit is contained in:
@@ -128,6 +128,14 @@ final class TransformTests: XCTestCase {
|
||||
""")
|
||||
}
|
||||
|
||||
func testDictionaryEmpty() throws {
|
||||
let template = try HBMustacheTemplate(string: """
|
||||
{{#empty(array)}}Array{{/empty(array)}}{{#empty(dictionary)}}Dictionary{{/empty(dictionary)}}
|
||||
""")
|
||||
let object: [String: Any] = ["array":[], "dictionary":[:]]
|
||||
XCTAssertEqual(template.render(object), "ArrayDictionary")
|
||||
}
|
||||
|
||||
func testListOutput() throws {
|
||||
let object = [1, 2, 3, 4]
|
||||
let template = try HBMustacheTemplate(string: "{{#.}}{{.}}{{^last()}}, {{/last()}}{{/.}}")
|
||||
|
||||
Reference in New Issue
Block a user