Fix issue with indented partials (#19)

* Fix issue with indented partials

* Add test

* Add empty transform for string
This commit is contained in:
Adam Fowler
2023-01-14 08:50:51 +00:00
committed by GitHub
parent 185004fdce
commit fa56176223
4 changed files with 59 additions and 4 deletions

View File

@@ -82,7 +82,7 @@ final class TemplateRendererTests: XCTestCase {
XCTAssertEqual(template.render(Test(string: nil)), "test ")
}
func testOptionalSequence() throws {
func testOptionalSection() throws {
struct Test {
let string: String?
}
@@ -94,6 +94,22 @@ final class TemplateRendererTests: XCTestCase {
XCTAssertEqual(template2.render(Test(string: nil)), "test *")
}
func testOptionalSequence() throws {
struct Test {
let string: String?
}
let template = try HBMustacheTemplate(string: "test {{#.}}{{string}}{{/.}}")
XCTAssertEqual(template.render([Test(string: "string")]), "test string")
}
func testOptionalSequenceSection() throws {
struct Test {
let string: String?
}
let template = try HBMustacheTemplate(string: "test {{#.}}{{#string}}*{{.}}{{/string}}{{/.}}")
XCTAssertEqual(template.render([Test(string: "string")]), "test *string")
}
func testStructureInStructure() throws {
struct SubTest {
let string: String?