Skip to content

Commit

Permalink
Gracefully unexpected handle diagnostic tests paths
Browse files Browse the repository at this point in the history
If the file path of a diagnostic test doesn't have the expected prefix,
we shouldn't panic.
  • Loading branch information
yorickpeterse committed Aug 16, 2024
1 parent e68e1e0 commit aea733d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion std/test/compiler/test_diagnostics.inko
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ class Diagnostic {
# We remove the directory leading up to the file, that way the diagnostic
# lines in the test file don't need to specify the full file paths, and
# debugging failing tests is a little less annoying due to noisy output.
let file = (try string(map, 'file')).strip_prefix('${directory}/').get
let mut file = try string(map, 'file')

file = file.strip_prefix('${directory}/').or(file)

let line = try location(map, 'lines')
let column = try location(map, 'columns')
let message = try string(map, 'message')
Expand Down

0 comments on commit aea733d

Please sign in to comment.