Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Don't normalize whitespace in fourslash tests#18447

Merged
2 commits merged into
mastermicrosoft/TypeScript:masterfrom
crlfmicrosoft/TypeScript:crlfCopy head branch name to clipboard
Sep 14, 2017
Merged

Don't normalize whitespace in fourslash tests#18447
2 commits merged into
mastermicrosoft/TypeScript:masterfrom
crlfmicrosoft/TypeScript:crlfCopy head branch name to clipboard

Conversation

@ghost

@ghost ghost commented Sep 13, 2017

Copy link
Copy Markdown

Fixes #18349

The problem was that the test runner had code to normalize newlines, but it didn't change the index; so it thought that the new cursor was 1 character further along than it really was.

Changed fourslash tests to no longer normalize newlines; discovered a few bugs along the way (#18445) where CRLF characters are inserted into LF documents. (Fourslash tests are parsed with LF newlines even if the test file itself uses CRLF.)

Also had to fix an error related to #18291 where formatting options were being ignored due to an unused parameter.

Since this is just a test fix I don't think it needs a TS2.5 port.

Comment thread src/harness/fourslash.ts Outdated
if (this.normalizeNewlines(actualContent) !== this.normalizeNewlines(expectedContent)) {
this.raiseError(`verifyFileAfterApplyingRefactors failed: expected:\n${expectedContent}\nactual:\n${actualContent}`);
if (actualContent !== expectedContent) {
this.raiseError(`verifyFileAfterApplyingRefactors failed: expected:\n${makeWhitespaceVisible(expectedContent)}\nactual:\n${makeWhitespaceVisible(actualContent)}`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be a pain because we'll be unable to copy+paste the actual back into the test. If we're going to do this, we should only do it when the files differ only in whitespace

@RyanCavanaugh RyanCavanaugh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve with suggestion

@ghost ghost merged commit d96dfeb into master Sep 14, 2017
@ghost ghost deleted the crlf branch September 14, 2017 15:23
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apparent off-by-one error for extract method rename

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.