Only use padded test names to calculate the target padding size.

This commit is contained in:
Felix S. Klock II 2013-10-14 15:45:57 -04:00
parent c56bf67150
commit 602b3cd56c

View File

@ -640,11 +640,20 @@ fn callback(event: &TestEvent, st: &mut ConsoleTestState) {
}
}
let st = @mut ConsoleTestState::new(opts);
match tests.iter().map(|t| t.desc.name.to_str().len()).max() {
Some(l) => { st.max_name_len = l; },
fn len_if_padded(t: &TestDescAndFn) -> uint {
match t.testfn.padding() {
PadNone => 0u,
PadOnLeft | PadOnRight => t.desc.name.to_str().len(),
}
}
match tests.iter().max_by(|t|len_if_padded(*t)) {
Some(t) => {
let n = t.desc.name.to_str();
debug2!("Setting max_name_len from: {}", n);
st.max_name_len = n.len();
},
None => {}
}
debug2!("tests max_name_len: {}", st.max_name_len);
run_tests(opts, tests, |x| callback(&x, st));
match opts.save_metrics {
None => (),