8000 Fix CRLF line endings to LF by SteveL-MSFT · Pull Request #4941 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Fix CRLF line endings to LF #4941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

SteveL-MSFT
Copy link
Member

Was hoping to take this change later, but due to the change in .gitattributes that we merged, it appears that any new clone will show these files as modified (as git auto fixes them). For anyone with an existing clone, when they fetch/pull, a subset of files that changed from their fork will also be autocorrected. Might as well take this now.

Copy link
Contributor
@dantraMSFT dantraMSFT left a comment

Choose a reason for hiding this comment

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

LGTM - I cloned your repo/line-endings and don't see any modified files.

@dantraMSFT
Copy link
Contributor

The auto correction of line endings broke a test: Test that Unicode escape sequence in single quoted here string is not processed

The test data is using a multiline Here string and it ends up with \n for newlines. The test is using powershell escaped 'r'n so the strings no longer match.

@SteveL-MSFT
Copy link
Member Author
SteveL-MSFT commented Sep 28, 2017

@dantraMSFT I'll fix that and resubmit with [feature] so essentially all tests are run

@@ -317,7 +317,7 @@ foo``u{2195}abc

'@
"@
$result | should be "`r`nfoo``u{2195}abc`r`n"
$result | should be "`nfoo``u{2195}abc`n"
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not have parser tests that are sensitive to the line feeds of the file.
Such tests should generate the strings with `n or `r`n as desired, and if it must be read from a file (which parser tests normally don't need) - then generate the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

This test is only for validating that the unicode escaped character isn't processed. The newlines are not important for this test unless I'm misunderstanding this test case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IIRC it is not line feeds of the file but the fact that PowerShell here strings use `n. This test is checking Unicode esc sequences inside a here string. OTOH, we don't have to test the entire string. The point of this test was to ensure we ignore this esc seq in a single quoted here string. This test could use a regex match to look for the esc seq.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, here strings contain whatever newline the file had - it does no translation.

But the point here is - the test shouldn't be sensitive to that, e.g. if git checkouts out the file with `r`n, test shouldn't fail.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, I trust your memory over mine. :-) At the console, here strings use `n. But in a file, yeah, I guess it makes sense that here string uses whatever the file uses for eol.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll change it to a regex to handle both cases

@SteveL-MSFT SteveL-MSFT force-pushed the line-endings branch 2 times, most recently from 0fdd9ec to 0dd05ae Compare September 29, 2017 00:45
@SteveL-MSFT
Copy link
Member Author

Need to figure out how to remove the Pester submodule change from the oldest commit in this PR

fixed test to align with file EOL
make parser test robust against EOL
@SteveL-MSFT
Copy link
Member Author

Well, messed up this PR trying to remove the submodule change. Will try again in new PR.

@SteveL-MSFT
Copy link
Member Author

New PR #4943

@SteveL-MSFT SteveL-MSFT deleted the line-endings branch October 26, 2018 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0