Skip to content

Commit 256167a

Browse files
committed
Fix test errors that panic outside of the crate.
Rust display the source file to the outside crate, which probably isn't available in the current workspace. Next/Prev message was opening a non-existent file.
1 parent 581f6c5 commit 256167a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

rust/opanel.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ def on_data(self, proc, data):
7979
appended)
8080
if m:
8181
path = os.path.join(self.base_path, m.group(1))
82+
if not os.path.exists(path):
83+
# Panics outside of the crate display a path to that
84+
# crate's source file (such as libcore), which is probably
85+
# not available.
86+
return
8287
lineno = int(m.group(2)) - 1
8388
# Region columns appear to the left, so this is +1.
8489
col = int(m.group(3))

tests/message-order/tests/test_test_output.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ fn slow() {
5252
// This just prints a simple warning.
5353
std::thread::sleep(std::time::Duration::from_secs(65));
5454
}
55+
56+
#[test]
57+
fn panic_outside_crate() {
58+
// This (unfortunately) should not show up as an error when running tests
59+
// since Rust prints the path to src/libcore/result.rs.
60+
Err::<i32, &str>("err").unwrap();
61+
}

0 commit comments

Comments
 (0)