diff options
Diffstat (limited to 'src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs')
-rw-r--r-- | src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs b/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs new file mode 100644 index 000000000..dd68c0685 --- /dev/null +++ b/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs @@ -0,0 +1,10 @@ +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())); + } +} |