Add test for crashing

This commit is contained in:
David Jennes
2018-09-22 00:54:10 +02:00
parent 07a6b2aea5
commit 4f84627caa

View File

@@ -61,12 +61,17 @@ class LexerTests: XCTestCase {
$0.it("can tokenize an unclosed block") {
let lexer = Lexer(templateString: "{%}")
let _ = lexer.tokenize()
_ = lexer.tokenize()
}
$0.it("can tokenize incorrect syntax without crashing") {
let lexer = Lexer(templateString: "func some() {{% if %}")
_ = lexer.tokenize()
}
$0.it("can tokenize an empty variable") {
let lexer = Lexer(templateString: "{{}}")
let _ = lexer.tokenize()
_ = lexer.tokenize()
}
$0.it("can tokenize with new lines") {
@@ -95,3 +100,4 @@ class LexerTests: XCTestCase {
}
}
}
}