pub struct TestGenerator;Implementations§
Source§impl TestGenerator
impl TestGenerator
pub fn new() -> Self
Sourcepub async fn generate(&self) -> Result<(), Error>
pub async fn generate(&self) -> Result<(), Error>
Builds all the programs and creates .program_client directory. Initializes the
trdelnik-tests/tests directory with all the necessary files. Adds the
test.rs file and generates Cargo.toml with dev-dependencies. Updates root’s Cargo.toml
workspace members.
The crate is generated from trdelnik-tests template located in client/src/templates.
Before you start writing trdelnik tests do not forget to add your program as a dependency
to the trdelnik-tests/Cargo.toml. For example:
# <project_root>/trdelnik-tests/Cargo.toml
# ...
[dev-dependencies]
my-program = { path = "../programs/my-program" }
# ...Then you can easily use it in tests:
ⓘ
use my_program;
// ...
#[trdelnik_test]
async fn test() {
// ...
my_program::do_something(/*...*/);
// ...
}§Errors
It fails when:
- there is not a root directory (no
Anchor.tomlfile)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TestGenerator
impl RefUnwindSafe for TestGenerator
impl Send for TestGenerator
impl Sync for TestGenerator
impl Unpin for TestGenerator
impl UnwindSafe for TestGenerator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more