mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00
11 lines
304 B
Rust
11 lines
304 B
Rust
pub trait Testable {
|
|
fn name(&self) -> String;
|
|
fn run(&self) -> Option<String>; // None will be success, Some is the error message
|
|
}
|
|
|
|
pub fn runner(tests: &[&dyn Testable]) {
|
|
for t in tests {
|
|
print!("{}........{}", t.name(), t.run().unwrap_or_else(|| "SUCCESS".to_string()));
|
|
}
|
|
}
|