Replace raw UTF8 parser with String parser (#6)
* Replace UTF8 parser with String based one * swift format * Add parsing errors that include context about where error is * Remove old error tests
This commit is contained in:
@@ -31,39 +31,6 @@ final class TemplateParserTests: XCTestCase {
|
||||
let template = try HBMustacheTemplate(string: "{{ section }}")
|
||||
XCTAssertEqual(template.tokens, [.variable(name: "section")])
|
||||
}
|
||||
|
||||
func testSectionEndError() throws {
|
||||
XCTAssertThrowsError(_ = try HBMustacheTemplate(string: "test {{#section}}")) { error in
|
||||
switch error {
|
||||
case HBMustacheTemplate.Error.expectedSectionEnd:
|
||||
break
|
||||
default:
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testSectionCloseNameIncorrectError() throws {
|
||||
XCTAssertThrowsError(_ = try HBMustacheTemplate(string: "test {{#section}}{{/error}}")) { error in
|
||||
switch error {
|
||||
case HBMustacheTemplate.Error.sectionCloseNameIncorrect:
|
||||
break
|
||||
default:
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testUnmatchedNameError() throws {
|
||||
XCTAssertThrowsError(_ = try HBMustacheTemplate(string: "test {{section#}}")) { error in
|
||||
switch error {
|
||||
case HBMustacheTemplate.Error.unfinishedName:
|
||||
break
|
||||
default:
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension HBMustacheTemplate: Equatable {
|
||||
|
||||
Reference in New Issue
Block a user