Struct endbasic_std::testutils::Tester[][src]

#[must_use]pub struct Tester { /* fields omitted */ }

Builder pattern to prepare an EndBASIC machine for testing purposes.

Implementations

impl Tester[src]

pub fn from(machine: Machine) -> Self[src]

Creates a new tester using the given Machine.

pub fn add_command(self, command: Rc<dyn Command>) -> Self[src]

Registers the given builtin command into the machine, which must not yet be registered.

pub fn add_function(self, function: Rc<dyn Function>) -> Self[src]

Registers the given builtin function into the machine, which must not yet be registered.

pub fn add_input_chars(self, golden_in: &str) -> Self[src]

Adds the golden_in characters as console input.

pub fn get_machine(&mut self) -> &mut Machine[src]

Returns a mutable reference to the machine inside the tester.

This method should generally not be used, except to run native methods that have side-effects on the machine that we'd like to validate later.

pub fn get_console(&self) -> Rc<RefCell<MockConsole>>[src]

Gets the mock console from the tester.

This method should generally not be used. Its primary utility is to hook externally-instantiated commands into the testing features.

pub fn get_store(&self) -> Rc<RefCell<InMemoryStore>>[src]

Gets the in-memory store from the tester.

This method should generally not be used. Its primary utility is to hook externally-instantiated commands into the testing features.

pub fn get_program(&self) -> Rc<RefCell<RecordedProgram>>[src]

Gets the recorded program from the tester.

This method should generally not be used. Its primary utility is to hook externally-instantiated commands into the testing features.

pub fn set_program(self, text: &str) -> Self[src]

Sets the initial contents of the recorded program to text. Can only be called once and text must not be empty.

pub fn write_file(self, name: &str, content: &str) -> Self[src]

Creates or overwrites a file in the store.

pub fn run<S: Into<String>>(&mut self, script: S) -> Checker<'_>[src]

Runs script in the configured machine and returns a Checker object to validate expectations about the execution.

Trait Implementations

impl Default for Tester[src]

fn default() -> Self[src]

Creates a new tester for a fully-equipped (interactive) machine.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,