BuilderTester

Struct BuilderTester 

Source
pub struct BuilderTester { /* private fields */ }
Expand description

A concurrent builder testing utility that can run tests against multiple files with timeout support.

The BuilderTester provides functionality to test builders against a directory of files with specific extensions, comparing actual output against expected results stored in JSON files, with configurable timeout protection.

Implementations§

Source§

impl BuilderTester

Source

pub fn new<P: AsRef<Path>>(root: P) -> Self

Creates a new builder tester with the specified root directory and default 10-second timeout.

Source

pub fn with_extension(self, extension: impl ToString) -> Self

Adds a file extension to test against.

Source

pub fn with_timeout(self, timeout: Duration) -> Self

Sets the timeout for building operations.

§Arguments
  • timeout - The maximum duration to wait for building to complete
§Returns

A new BuilderTester with the specified timeout

Source

pub fn run_tests<L, B>(self, builder: &B) -> Result<(), OakError>
where B: Builder<L> + Send + Sync, L: Language + Send + Sync + 'static, L::TypedRoot: Serialize + Debug + Sync + Send,

Run tests for the given builder against all files in the root directory with the specified extensions.

§Arguments
  • builder: The builder to test.
§Examples
use oak_core::helpers::building::BuilderTester;

let tester = BuilderTester::new("tests/builder").with_extension("valkyrie");
tester.run_tests(&my_builder)?;

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.