This got me stuck for a while:
expect_message(cli::cli_alert_warning("'args' contains only fixed elements"),
"'args' contans only fixed elements")
# ! 'args' contains only fixed elements
# Error: Expected `cli::cli_alert_warning("'args' contains only fixed elements")` to throw a message.
Initially I thought that perhaps for cli_alert_warning() I should have used expect_output() or expect_warning(), but neither of those helped. Only after a lot of head-scratching I realised that there was a typo in my expectation.
I think the wording expected to throw a message is misleading when a message is actually being thrown. Ideally in such case, it should say something like:
`actual`: ! 'args' contains only fixed elements
`expected`: ! 'args' contans only fixed elements
This got me stuck for a while:
Initially I thought that perhaps for
cli_alert_warning()I should have usedexpect_output()orexpect_warning(), but neither of those helped. Only after a lot of head-scratching I realised that there was a typo in my expectation.I think the wording
expected to throw a messageis misleading when a message is actually being thrown. Ideally in such case, it should say something like: