pub struct BatsWriter { /* private fields */ }Expand description
BATS file writer for generating test files
Implementations§
Source§impl BatsWriter
impl BatsWriter
Sourcepub fn new(
output_dir: PathBuf,
binary_name: String,
binary_path: PathBuf,
) -> Result<Self>
pub fn new( output_dir: PathBuf, binary_name: String, binary_path: PathBuf, ) -> Result<Self>
Create a new BATS writer
Sourcepub fn write_tests(&self, test_cases: &[TestCase]) -> Result<Vec<PathBuf>>
pub fn write_tests(&self, test_cases: &[TestCase]) -> Result<Vec<PathBuf>>
Write test cases to BATS files, organized by category
§Examples
use cli_testing_specialist::generator::{TestGenerator, BatsWriter};
use cli_testing_specialist::analyzer::CliParser;
use cli_testing_specialist::types::TestCategory;
use std::path::{Path, PathBuf};
let parser = CliParser::new();
let analysis = parser.analyze(Path::new("/usr/bin/curl"))?;
let generator = TestGenerator::new(
analysis.clone(),
vec![TestCategory::Basic, TestCategory::Security]
);
let tests = generator.generate()?;
let writer = BatsWriter::new(
PathBuf::from("tests"),
analysis.binary_name.clone(),
analysis.binary_path.clone()
)?;
let bats_files = writer.write_tests(&tests)?;
println!("Generated {} BATS files", bats_files.len());Sourcepub fn validate_bats_file(&self, file_path: &Path) -> Result<()>
pub fn validate_bats_file(&self, file_path: &Path) -> Result<()>
Validate generated BATS file syntax
Auto Trait Implementations§
impl Freeze for BatsWriter
impl RefUnwindSafe for BatsWriter
impl Send for BatsWriter
impl Sync for BatsWriter
impl Unpin for BatsWriter
impl UnwindSafe for BatsWriter
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> 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