Skip to content

Commit

Permalink
replace implicitly unwrapped optional with fatalError
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyapuchka committed Aug 13, 2018
1 parent 92ebfe5 commit 96a004e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Tests/StencilTests/EnvironmentSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func testEnvironment() {
}

func expectedSyntaxError(token: String, template: Template, description: String) -> TemplateSyntaxError {
let range = template.templateString.range(of: token)!
guard let range = template.templateString.range(of: token) else {
fatalError("Can't find '\(token)' in '\(template)'")
}
let rangeLine = template.templateString.rangeLine(range)
let sourceMap = SourceMap(filename: template.name, line: rangeLine)
let token = Token.block(value: token, at: sourceMap)
Expand Down
4 changes: 3 additions & 1 deletion Tests/StencilTests/FilterSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ func testFilter() {
var filterExtension: Extension!

func expectedSyntaxError(token: String, template: Template, description: String) -> TemplateSyntaxError {
let range = template.templateString.range(of: token)!
guard let range = template.templateString.range(of: token) else {
fatalError("Can't find '\(token)' in '\(template)'")
}
let rangeLine = template.templateString.rangeLine(range)
let sourceMap = SourceMap(filename: template.name, line: rangeLine)
let token = Token.block(value: token, at: sourceMap)
Expand Down

0 comments on commit 96a004e

Please sign in to comment.