pub struct TestGenerator { /* private fields */ }Expand description
Test generator for HIR functions
Implementations§
Source§impl TestGenerator
impl TestGenerator
pub fn new(config: TestGenConfig) -> Self
Sourcepub fn generate_test_items_for_function(
&self,
func: &HirFunction,
) -> Result<Vec<TokenStream>>
pub fn generate_test_items_for_function( &self, func: &HirFunction, ) -> Result<Vec<TokenStream>>
Generate test items for a single function (without mod tests wrapper)
DEPYLER-0280 FIX: This generates test functions only, not the module wrapper. The module wrapper should be added once at the file level.
Sourcepub fn generate_tests_module(
&self,
functions: &[HirFunction],
) -> Result<Option<TokenStream>>
pub fn generate_tests_module( &self, functions: &[HirFunction], ) -> Result<Option<TokenStream>>
Generate a complete test module for multiple functions
DEPYLER-0280 FIX: Wraps all test items in a single mod tests {} block.
This prevents “the name tests is defined multiple times” errors.
Sourcepub fn generate_tests(&self, func: &HirFunction) -> Result<Option<TokenStream>>
👎Deprecated since 3.19.22: Use generate_tests_module() to avoid duplicate mod tests blocks (DEPYLER-0280)
pub fn generate_tests(&self, func: &HirFunction) -> Result<Option<TokenStream>>
Generate tests for a function if applicable (DEPRECATED - use generate_tests_module instead)
DEPYLER-0280: This function is deprecated because it creates duplicate mod tests {} blocks.
Use generate_tests_module() for module-level test generation instead.
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<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