sandersn / mini-typescript

A miniature model of the Typescript compiler, intended to teach the structure of the real Typescript compiler
MIT License
1.14k stars 61 forks source link

11 test failures on Windows (fresh clone at e8cbe96) #9

Open morzel85 opened 3 years ago

morzel85 commented 3 years ago

More joys of Windows (works fine on Ubuntu WSL)... Sorry ;) Many tests fail on freshly cloned repo:

redeclare failed: Expected baselines to match
 - result   - baselines/local/redeclare.tree.baseline
 - expected - baselines/reference/redeclare.tree.baseline
 - run: diff baselines/local/redeclare.tree.baseline baselines/reference/redeclare.tree.baseline

redeclare failed: Expected baselines to match
 - result   - baselines/local/redeclare.errors.baseline
 - expected - baselines/reference/redeclare.errors.baseline
 - run: diff baselines/local/redeclare.errors.baseline baselines/reference/redeclare.errors.baseline

redeclare failed: Expected baselines to match
 - result   - baselines/local/redeclare.js.baseline
 - expected - baselines/reference/redeclare.js.baseline
 - run: diff baselines/local/redeclare.js.baseline baselines/reference/redeclare.js.baseline

singleIdentifier failed: Expected baselines to match
 - result   - baselines/local/singleIdentifier.errors.baseline
 - expected - baselines/reference/singleIdentifier.errors.baseline
 - run: diff baselines/local/singleIdentifier.errors.baseline baselines/reference/singleIdentifier.errors.baseline

singleTypedVar failed: Expected baselines to match
 - result   - baselines/local/singleTypedVar.errors.baseline
 - expected - baselines/reference/singleTypedVar.errors.baseline
 - run: diff baselines/local/singleTypedVar.errors.baseline baselines/reference/singleTypedVar.errors.baseline

twoStatements failed: Expected baselines to match
 - result   - baselines/local/twoStatements.tree.baseline
 - expected - baselines/reference/twoStatements.tree.baseline
 - run: diff baselines/local/twoStatements.tree.baseline baselines/reference/twoStatements.tree.baseline

twoStatements failed: Expected baselines to match
 - result   - baselines/local/twoStatements.errors.baseline
 - expected - baselines/reference/twoStatements.errors.baseline
 - run: diff baselines/local/twoStatements.errors.baseline baselines/reference/twoStatements.errors.baseline

twoStatements failed: Expected baselines to match
 - result   - baselines/local/twoStatements.js.baseline
 - expected - baselines/reference/twoStatements.js.baseline
 - run: diff baselines/local/twoStatements.js.baseline baselines/reference/twoStatements.js.baseline

twoTypedStatements failed: Expected baselines to match
 - result   - baselines/local/twoTypedStatements.tree.baseline
 - expected - baselines/reference/twoTypedStatements.tree.baseline
 - run: diff baselines/local/twoTypedStatements.tree.baseline baselines/reference/twoTypedStatements.tree.baseline

twoTypedStatements failed: Expected baselines to match
 - result   - baselines/local/twoTypedStatements.errors.baseline
 - expected - baselines/reference/twoTypedStatements.errors.baseline
 - run: diff baselines/local/twoTypedStatements.errors.baseline baselines/reference/twoTypedStatements.errors.baseline

twoTypedStatements failed: Expected baselines to match
 - result   - baselines/local/twoTypedStatements.js.baseline
 - expected - baselines/reference/twoTypedStatements.js.baseline
 - run: diff baselines/local/twoTypedStatements.js.baseline baselines/reference/twoTypedStatements.js.baseline

Sample file diff: baselines\reference\redeclare.errors.baseline

[
  {
    "pos": 14,
    "message": "Cannot redeclare x"
  }
]

baselines\local\redeclare.errors.baseline

[
  {
    "pos": 11,
    "message": "Expected identifier or literal but got Unknown"
  },
  {
    "pos": 15,
    "message": "parseToken: Expected EOF but got Var"
  }
]

OS: Microsoft Windows 10 Home 10.0.19041

Gerrit0 commented 3 years ago

This is almost certainly going to be because you have git set up to check out with windows line endings and lex.ts doesn't properly handle \r on line 18. The .gitattributes file only specifies the line endings for /baselines/reference, so this setup will still result in the test files in /tests being checked out with CRLF.

simonbuchan commented 2 weeks ago

In particular, looks like #5