Skip to content

Commit 336da14

Browse files
committed
Update test regex for 1.73
1 parent ca7f26b commit 336da14

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

rust/opanel.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@
1111
# this would be a problem. If it is, it's a simple matter of changing this.
1212
PANEL_NAME = 'exec'
1313

14+
# Pattern used for finding location of panics in test output.
15+
#
16+
# Rust 1.73 changed the formatting of a panic message.
17+
# Older versions looked like:
18+
# thread 'basic_error1' panicked at 'assertion failed: false', tests/test_test_output.rs:9:5
19+
# 1.73 changed it to look like:
20+
# thread 'basic_error1' panicked at tests/test_test_output.rs:9:5:
21+
# assertion failed: false
22+
PANIC_PATTERN = r'(?:, |panicked at )([^,<\n]*\.[A-z]{2}):([0-9]+)'
1423

1524
def create_output_panel(window, base_dir):
1625
output_view = window.create_output_panel(PANEL_NAME)
@@ -21,8 +30,7 @@ def create_output_panel(window, base_dir):
2130
s.set('result_file_regex', '^[^:]+: (..[^:]*):([0-9]+): (.*)$')
2231
else:
2332
build_pattern = '^[ \\t]*-->[ \\t]*([^<\n]*):([0-9]+):([0-9]+)'
24-
test_pattern = ', ([^,<\n]*\\.[A-z]{2}):([0-9]+)'
25-
pattern = '(?|%s|%s)' % (build_pattern, test_pattern)
33+
pattern = '(?|%s|%s)' % (build_pattern, PANIC_PATTERN)
2634
s.set('result_file_regex', pattern)
2735
# Used for resolving relative paths.
2836
s.set('result_base_dir', base_dir)
@@ -76,8 +84,9 @@ def on_data(self, proc, data):
7684
# Re-fetch the data to handle things like \t expansion.
7785
appended = self.output_view.substr(
7886
sublime.Region(region_start, self.output_view.size()))
79-
m = re.search(r', ([^,<\n]*\.[A-z]{2}):([0-9]+):([0-9]+)',
80-
appended)
87+
# This pattern also includes column numbers (which Sublime's
88+
# result_file_regex doesn't support).
89+
m = re.search(PANIC_PATTERN + r':([0-9]+)', appended)
8190
if m:
8291
path = os.path.join(self.base_path, m.group(1))
8392
if not os.path.exists(path):

0 commit comments

Comments
 (0)