-
Notifications
You must be signed in to change notification settings - Fork 480
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
Refactor directive prologue tests for parsers #1592
Refactor directive prologue tests for parsers #1592
Conversation
Promote consistency in coverage by adding new tests that correspond to those that were authored previously.
Verify runtime semantics through assignment to an unresolvable reference, reducing the complexity of tests that previously relied on the semantics of the `eval` function.
Test262 already includes tests to ensure the correct runtime semantics for these forms. Add equivalent tests designed to verify that the equivalent parsing behavior is also observed.
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-2-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: use-strict-directive
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-15-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-2-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: use-strict-directive
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-2-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: use-strict-directive
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-19-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-16-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-2-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-22-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
es5id: 10.1.1-25-s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add or replace es5id with:
esid: sec-strict-mode-code
@rwaldron Metadata added! |
It looks like the linter has a faulty rule. There are a number of ways we could address this:
I'm happy to help out with any of these, though my preference would be the fourth. @rwaldron what do you think? |
eval("var public = 1;"); | ||
assert.sameValue(public, 1); | ||
test262unresolvable = null; | ||
assert.sameValue(test262unresolvable, null); | ||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we have some coverage for the pragma only preceded by an empty statement. I did not find anything from a quick grep.
function fun() {
;'use strict';
unr = null;
assert.sameValue(unr, null);
}
fun();
I'm positive with this solution. |
To unblock this, I've submitted #1632 (as an alternative to jugglinmike#2). |
I've rebased this locally and confirmed that linting passes:
|
Merged locally, pushed to master. Thanks! |
@leobalter @rwaldron This is in service of gh-1356. The tests modified in this patch have a trait that differentiates them from the tests we've previously reformatted for the benefit of parsers. Because they concern the observance of strict mode, there are parsing and runtime behaviors that we need to verify. So while in those previous patches, we could just replace the calls to
eval
with direct program code, in this case, I've taken care to preserve assertions for runtime semantics. That said, I've still modified those tests in order to make this consideration more clear (they now test for strict mode through assignment instead ofeval
).To facilitate review (and help verify that I didn't invalidate any of the old tests), I've split this work into a number of distinct commits. Hope that helps!