Cuckoo
Cuckoo copied to clipboard
Unterminated string literal when mocking function with long callback
I'm mocking a protocol with a function that looks like this:
func foo(
completion: @escaping (
_ bar: Int,
_ baz: Int,
_ qux: Int
) -> Void
)
The generated mocks do not properly remove the line breaks before attempting to put it into a single-line string literal, resulting in the errors Unterminated string literal, Consecutive statements on a line must be separated by ';', Expected expression, and '_' can only appear in a pattern or on the left side of an assignment, several times each.