Trait goldenscript::Runner

source ·
pub trait Runner {
    // Required method
    fn run(&mut self, command: &Command) -> Result<String, Box<dyn Error>>;

    // Provided methods
    fn start_script(&mut self) -> Result<(), Box<dyn Error>> { ... }
    fn end_script(&mut self) -> Result<(), Box<dyn Error>> { ... }
    fn start_block(&mut self) -> Result<String, Box<dyn Error>> { ... }
    fn end_block(&mut self) -> Result<String, Box<dyn Error>> { ... }
}
Expand description

Runs goldenscript commands, returning their output.

Required Methods§

source

fn run(&mut self, command: &Command) -> Result<String, Box<dyn Error>>

Runs a goldenscript command, returning its output, or a string error if the command failed. To test error cases, return an Ok result containing e.g. the error message as output.

Provided Methods§

source

fn start_script(&mut self) -> Result<(), Box<dyn Error>>

Called at the start of a goldenscript. Used e.g. for initial setup. Can’t return output, since it’s not called in the context of a block.

source

fn end_script(&mut self) -> Result<(), Box<dyn Error>>

Called at the end of a goldenscript. Used e.g. for state assertions. Can’t return output, since it’s not called in the context of a block.

source

fn start_block(&mut self) -> Result<String, Box<dyn Error>>

Called at the start of a block. Used e.g. to output initial state. Any output is prepended to the block’s output.

source

fn end_block(&mut self) -> Result<String, Box<dyn Error>>

Called at the end of a block. Used e.g. to output final state. Any output is appended to the block’s output.

Implementors§