Skip to content
Playground(another site)

bynk.parse.clause_after_statement

Error A stub or env clause came after a statement in a test case; they lead the case body.

A stub or env clause sets up the world a test case runs in, so it comes at the start of the case body, before any statement. One after a let or other statement is refused, so the setup reads in one place above the steps that depend on it. Move the clause above the first statement of the case.

Example

suite demo {
case "x" {
let k = 1
stub Clock.now() returns 0 // ✗ after a statement
let t <- probe.call()
expect t == 0
}
}
suite demo {
case "x" {
stub Clock.now() returns 0 // ✓ before the statements
let k = 1
let t <- probe.call()
expect t == 0
}
}

In the Book

See also

  • Every code in its category, Parser, on the diagnostic index.
  • bynk explain bynk.parse.clause_after_statement shows the same from the installed toolchain, without a network.