mirror of
https://github.com/imjasonh/testscript-rs
synced 2026-07-08 17:16:38 +00:00
* add GHA workflow Signed-off-by: Jason Hall <jason@chainguard.dev> * fix CI Signed-off-by: Jason Hall <jason@chainguard.dev> * update readme Signed-off-by: Jason Hall <jason@chainguard.dev> * add badge Signed-off-by: Jason Hall <jason@chainguard.dev> --------- Signed-off-by: Jason Hall <jason@chainguard.dev>
19 lines
586 B
Rust
19 lines
586 B
Rust
//! Example of how to use testscript-rs to run test scripts
|
|
|
|
use testscript_rs::testscript;
|
|
|
|
fn main() {
|
|
// Change to the project root directory for the example
|
|
if let Ok(manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") {
|
|
std::env::set_current_dir(manifest_dir).expect("Failed to change directory");
|
|
}
|
|
|
|
// Run all tests in testdata directory
|
|
match testscript::run("testdata").execute() {
|
|
Ok(()) => println!("All tests passed!"),
|
|
Err(e) => {
|
|
eprintln!("Test failed: {}", e);
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
}
|