Skip to contents

Gets the prompt with get_prompt(), and expects the text of its messages, one per line, to match regexp. A prompt that cannot be got, an unknown name, invalid arguments or a function that fails, is an error.

Usage

expect_prompt(prompt, args = list(), regexp = NULL, ...)

Arguments

prompt

Name of the prompt.

args

Named list of arguments, each a string.

regexp

Regular expression the text of the prompt must match, or NULL.

...

Passed to get_prompt().

Value

The result of prompts/get, invisibly.

Examples

if (FALSE) { # \dontrun{
# In the tests of a package made by create_mordew():
expect_prompt(
  "review_run",
  list(
    run_id = "2025-03-01"
  ),
  "Review the run"
)
} # }