MCPcopy Index your code
hub / github.com/endbasic/endbasic / run_n

Method run_n

std/src/testutils.rs:758–775  ·  view source on GitHub ↗

Runs `scripts` in the configured machine and returns a `Checker` object to validate expectations about the execution. The first entry in `scripts` to fail aborts execution and allows checking the result of that specific invocation. This is useful when compared to `run` because `Machine::exec` compiles the script as one unit and thus compilation errors may prevent validating other operations late

(&mut self, scripts: &[&str])

Source from the content-addressed store, hash-verified

756 /// This is useful when compared to `run` because `Machine::exec` compiles the script as one
757 /// unit and thus compilation errors may prevent validating other operations later on.
758 pub fn run_n(&mut self, scripts: &[&str]) -> Checker<'_> {
759 let mut machine = self.build_machine();
760 let mut result = Ok(None);
761 for script in scripts {
762 match machine.compile(&mut script.as_bytes()) {
763 Ok(()) => (),
764 Err(e) => {
765 result = Err(format!("{}", e));
766 break;
767 }
768 }
769 result = block_on(machine.exec()).map_err(|e| format!("{}", e));
770 if result.is_err() {
771 break;
772 }
773 }
774 Checker::new(self, machine, result)
775 }
776}
777
778/// A tester that allows continuing a previous check.

Callers 2

test_clear_okFunction · 0.80
test_color_okFunction · 0.80

Calls 4

build_machineMethod · 0.80
as_bytesMethod · 0.80
compileMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected