crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.2k stars 1.61k forks source link

Fix relative file paths in spec output #14725

Closed straight-shoota closed 1 week ago

straight-shoota commented 1 week ago

Relativized paths in the spec output (for example for Failed examples) are wrong on Windows. They incorrectly include a leading directory separator, making them relative to the drive root:

Failed examples:

crystal spec \spec\fail_spec.cr:3 # assert

The implementation does not account for other directory separators than \. This fix replaces it with Path#relative_to which handles this correctly.