sophiajt / new-nu-parser

23 stars 10 forks source link

Add pre-pass to tests to replace CRLF with LF, to fix tests on Windows #27

Open LeoLuxo opened 3 months ago

LeoLuxo commented 3 months ago

This fixes running tests on Windows by replacing all CRLF line endings with LF before running tests. Without this, running the tests on Windows results in different spans from the snapshots, failing the tests.

This does not change the parsing though, where both CRLF and LF lines endings still need to be accounted for. (Although perhaps we could make this a global pre-parsing pass too?)

sholderbach commented 3 months ago

Sounds good to me for now to get the ball rolling for all contributors working on Windows. We possibly want to preserve the line endings as this parser implementation is envisioned to also be used in a loss less context for a code formatter (and to keep it simple for the LSP implementation). We probably need additional tests for that at some point but it sounds like a bit too much trouble for the simple insta testing right now. (maybe we can add some automated way to test both line endings from one kind of format, as we probably want coverage in anything that tries to handle line endings manually.)

kubouch commented 3 months ago

@LeoLuxo Can you move this PR to https://github.com/nushell/new-nu-parser? We're moving this repository under the nushell org.