Skip to content
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

Fix unit tests that use Function.prototype.toString() #502

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cspotcode
Copy link
Contributor

Function.prototype.toString() returns the line endings of the source code on disk, which is not guaranteed to match os.EOL without a .gitattributes file.

The fix is simple: normalize line endings after calling toString() to get predictable results.

toString() returns the line endings of the source code on disk, which is not guaranteed to be \n nor \r\n in the absence of .gitattributes
Copy link
Owner

@benjamn benjamn left a comment

Choose a reason for hiding this comment

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

This looks reasonable, even though tests are failing (for unrelated reasons).

@@ -272,7 +276,7 @@ describe("lines", function() {
});

it("Slice", function SliceTest() {
var code = String(SliceTest),
var code = functionToString(SliceTest);
Copy link
Owner

Choose a reason for hiding this comment

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

We should keep the comma here.

@@ -294,7 +298,7 @@ describe("lines", function() {
}

it("GetSourceLocation", function GetSourceLocationTest() {
var code = String(GetSourceLocationTest),
var code = functionToString(GetSourceLocationTest);
Copy link
Owner

Choose a reason for hiding this comment

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

And here.

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.

None yet

2 participants