[][src]Struct wasm_bindgen_test::__rt::Context

pub struct Context { /* fields omitted */ }

Runtime test harness support instantiated in JS.

The node.js entry script instantiates a Context here which is used to drive test execution.

Methods

impl Context[src]

pub fn new() -> Context[src]

Creates a new context ready to run tests.

A Context is the main structure through which test execution is coordinated, and this will collect output and results for all executed tests.

pub fn args(&mut self, args: Vec<JsValue>)[src]

Inform this context about runtime arguments passed to the test harness.

Eventually this will be used to support flags, but for now it's just used to support test filters.

pub fn run(&self, tests: Vec<JsValue>) -> Promise[src]

Executes a list of tests, returning a promise representing their eventual completion.

This is the main entry point for executing tests. All the tests passed in are the JS Function object that was plucked off the WebAssembly.Instance exports list.

The promise returned resolves to either true if all tests passed or false if at least one test failed.

impl Context[src]

pub fn execute_sync(&self, name: &str, f: impl FnOnce() + 'static)[src]

Entry point for a synchronous test in wasm. The #[wasm_bindgen_test] macro generates invocations of this method.

pub fn execute_async<F>(&self, name: &str, f: impl FnOnce() -> F + 'static) where
    F: Future<Item = (), Error = JsValue> + 'static, 
[src]

Entry point for an asynchronous in wasm. The #[wasm_bindgen_test(async)] macro generates invocations of this method.

Trait Implementations

impl From<Context> for JsValue[src]

impl RefFromWasmAbi for Context[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, Context>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more

impl WasmDescribe for Context[src]

impl IntoWasmAbi for Context[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl FromWasmAbi for Context[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl OptionFromWasmAbi for Context[src]

impl OptionIntoWasmAbi for Context[src]

impl RefMutFromWasmAbi for Context[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, Context>

Same as RefFromWasmAbi::Anchor

Auto Trait Implementations

impl !Send for Context

impl !Sync for Context

impl Unpin for Context

impl !RefUnwindSafe for Context

impl !UnwindSafe for Context

Blanket Implementations

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi