LexerTester

Struct LexerTester 

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

A lexer testing utility that can run tests against multiple files.

The LexerTester provides functionality to test lexers against a directory of files with specific extensions, comparing actual output against expected results stored in JSON files.

Implementations§

Source§

impl LexerTester

Source

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

Creates a new lexer tester with the specified root directory.

Source

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

Adds a file extension to test against.

Source

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

Sets the timeout duration for each test.

Source

pub fn run_tests<L, Lex>(self, lexer: Lex) -> Result<(), OakError>
where L: Language + Send + Sync + 'static, L::SyntaxKind: Serialize + Debug + Send + Sync, Lex: Lexer<L> + Send + Sync + 'static + Clone,

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

§Arguments
  • lexer: The lexer to test.
§Examples

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,