diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-10-14 15:45:57 -0400 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-10-14 17:19:15 -0400 |
| commit | 602b3cd56cb57782ef5772b3b737def4d9f3fd05 (patch) | |
| tree | 21e804cf80bd761d7c939a351254b2c3a8c0e81d | |
| parent | c56bf67150ecd87b0467bd4b2bd6099c83eff65e (diff) | |
| download | rust-602b3cd56cb57782ef5772b3b737def4d9f3fd05.tar.gz rust-602b3cd56cb57782ef5772b3b737def4d9f3fd05.zip | |
Only use padded test names to calculate the target padding size.
| -rw-r--r-- | src/libextra/test.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libextra/test.rs b/src/libextra/test.rs index 991be1b2d30..a352a2e4678 100644 --- a/src/libextra/test.rs +++ b/src/libextra/test.rs @@ -640,11 +640,20 @@ pub fn run_tests_console(opts: &TestOpts, } } 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 => (), |
