Case

previousLine

This scope affects coverage ranges beginning on the line before the token (or on the same line).

Declaration

case previousLine

Discussion

This scope is useful for functions like preconditionFailure, which reside in untestable code branches.

guard let x = y else { // ← The untested range starts at this brace... preconditionFailure("This should never happen.") // ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ // ...but the “preconditionFailure” token causes it to be exempt. } // Previous line tokens also affect the same line, so trailing closures still work: guard let x = y else { preconditionFailure("This should never happen.") }
macOS CentOS Ubuntu Amazon Linux