Skip to content

Commit 3da7c8f

Browse files
committed
compiletest: Shorten test names
1 parent fc83d82 commit 3da7c8f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/compiletest/compiletest.rc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,17 @@ pub fn make_test(config: &config, testfile: &Path) -> test::TestDescAndFn {
253253
}
254254

255255
pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
256+
257+
// Try to elide redundant long paths
258+
fn shorten(path: &Path) -> ~str {
259+
let filename = path.filename();
260+
let dir = path.pop().filename();
261+
fmt!("%s/%s", dir.get_or_default(~""), filename.get_or_default(~""))
262+
}
263+
256264
test::DynTestName(fmt!("[%s] %s",
257265
mode_str(config.mode),
258-
testfile.to_str()))
266+
shorten(testfile)))
259267
}
260268

261269
pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn {

0 commit comments

Comments
 (0)