mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 07:52:05 +03:00
more test runner niceness: color
This commit is contained in:
parent
fcf7ea161c
commit
9f0b2ea756
@ -8,3 +8,4 @@ dimensioned = { git = "https://github.com/paholg/dimensioned", rev = "0e1076ebfa
|
|||||||
gag = "0.1.10"
|
gag = "0.1.10"
|
||||||
geom = { path = "../geom" }
|
geom = { path = "../geom" }
|
||||||
sim = { path = "../sim" }
|
sim = { path = "../sim" }
|
||||||
|
yansi = "0.4.0"
|
||||||
|
@ -2,6 +2,7 @@ extern crate dimensioned;
|
|||||||
extern crate gag;
|
extern crate gag;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate sim;
|
extern crate sim;
|
||||||
|
extern crate yansi;
|
||||||
|
|
||||||
mod physics;
|
mod physics;
|
||||||
mod runner;
|
mod runner;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
// https://github.com/rust-lang/rust/issues/50297 would hopefully obsolete this approach.
|
||||||
|
|
||||||
use gag::Redirect;
|
use gag::Redirect;
|
||||||
use std;
|
use std;
|
||||||
|
use yansi::Paint;
|
||||||
|
|
||||||
pub struct TestRunner {
|
pub struct TestRunner {
|
||||||
results: Vec<TestResult>,
|
results: Vec<TestResult>,
|
||||||
@ -56,11 +59,11 @@ impl TestRunner {
|
|||||||
for result in self.results.into_iter() {
|
for result in self.results.into_iter() {
|
||||||
if result.pass {
|
if result.pass {
|
||||||
passed += 1;
|
passed += 1;
|
||||||
println!("- {}: PASS", result.test_name);
|
println!("- {}: {}", result.test_name, Paint::green("PASS"));
|
||||||
} else {
|
} else {
|
||||||
failed += 1;
|
failed += 1;
|
||||||
println!("- {}: FAIL", result.test_name);
|
println!("- {}: {}", result.test_name, Paint::red("FAIL"));
|
||||||
println!(" {}", result.output_path);
|
println!(" {}", Paint::cyan(result.output_path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user