-
Notifications
You must be signed in to change notification settings - Fork 444
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
Need to run tests in both strict mode and non-strict mode #35
Comments
(@erights, just fyi) Investigated this a bit today. Unfortunately this is not easy as many test cases are noStrict due to verifications they do. For example, ES5 15.2.3.5-4-214.js: function testcase() {
var descObj = {
writable: ""
};
var newObj = Object.create({}, {
prop: descObj
});
var hasProperty = newObj.hasOwnProperty("prop") && typeof newObj.prop === "undefined";
newObj.prop = 121;
return hasProperty && typeof newObj.prop === "undefined";
}
runTestCase(testcase); Similar cases exist when ensuring a non-extensible object can't be extended and a non-configurable property can't be deleted. I don't have an exact count of cases affected but I can confidently say it's over 100. A quick fix might be to tag these tests noStrict, but ideally the verification steps should be fixed to work in strict and non-strict. |
This change adds 'var' declarations for global variables to allow the tests to run in strict mode (see issue tc39#35). Extra care was taken to ensure the changes do not alter the test behavior, for example when implicit creation of global variables are part of the test. Note: The change does not fix all strict mode errors due to missing 'var' declarations.
This change adds 'var' declarations for global variables to allow the tests to run in strict mode (see issue #35). Extra care was taken to ensure the changes do not alter the test behavior, for example when implicit creation of global variables are part of the test. Note: The change does not fix all strict mode errors due to missing 'var' declarations.
I don't want to be the bearer of bad news, but there are still more than 1200 tests failing when running in strict mode. 😢 |
@anba noooo! I guess I messed up my harness command or something :( |
Just FYI |
@anba I see those too. I believe there is a race in test262-harness that causes failures when many tests are queued, because when I rerun them individually they succeed, eg
|
@smikes Update: It's still broken with node@0.12, but it works as expected in io.js@0.12 |
What's the status of this? |
The numbers from my earlier comment still apply, so ~1200 failing tests. |
…ed result value to a previously declared global (issue tc39#35)
…mplicit global variables (issue tc39#35)
- Add missing noStrict flags. - Change 13.2-15-1 and 13.2-18-1 to use assert.js and propertyHelper.js (simplifies writable and configurable checks while in strict mode). - Add variable declarations for globals. - Create copies of S13.2.1_A6_T1 and S13.2.1_A6_T2 instead of adding variable declarations, because both files seem to test implicit global variables. - Split S13_A14 and S13_A16 to work in strict mode. - Remove assignment to .name property.
…ed result value to a previously declared global (issue #35) Add missing variable declarations (issue #35) Split S12.6.3_A10 and S12.6.3_A10.1 because both files seem to test implicit global variables (issue #35) Changes (issue #35) - Add missing noStrict flags. - Change 13.2-15-1 and 13.2-18-1 to use assert.js and propertyHelper.js (simplifies writable and configurable checks while in strict mode). - Add variable declarations for globals. - Create copies of S13.2.1_A6_T1 and S13.2.1_A6_T2 instead of adding variable declarations, because both files seem to test implicit global variables. - Split S13_A14 and S13_A16 to work in strict mode. - Remove assignment to .name property. Add missing noStrict flags (issue #35) Add missing noStrict flags and variable declarations (issue #35) Add missing noStrict flags (issue #35)
- Add missing "var" declarations and noStrict flags - Move code which requires non-strict semantics from Array.prototype.find_this-arg.js to Array.prototype.find_this-arg-receiver-primitive.js - Remove duplicate code from Array.prototype.findIndex_this-arg.js, already present in Array.prototype.findIndex_this-arg-receiver-primitive.js - Remove test code from Array.of_assignment-to-new-object-length.js, does not work in strict mode Part of issue tc39#35
Add missing "var" declarations and noStrict flags. Part of issue tc39#35.
Add missing "var" declarations and noStrict flags. Part of issue tc39#35.
Add missing "var" declarations and noStrict flags. Part of issue tc39#35.
Add missing "var" declarations and noStrict flags. Part of issue tc39#35.
Add missing "var" declarations. Part of issue tc39#35.
@anba, any comments on how much further to go after your latest PRs? |
|
I can take on the Object tests , if that would help. |
Working on that this morning. |
- Add missing "var" declarations and noStrict flags - Add strict mode tests for: - arguments-object/10.6-6-3 -> arguments-object/10.6-6-3-s - arguments-object/10.6-6-4 -> arguments-object/10.6-6-4-s - Remove try-finally clean-up code - Add strict mode compatible tests for eval-code/S10.4.2_A1.1_T* - No strict mode compatible files added for eval-code/S10.4.2_A1.2_T*, because it doesn't really make sense in this context. - (S10.4.2_A1.1 and S10.4.2_A1.2 should probably be removed, because the tested behaviour is not required by the spec.) - Split S8.5_A10, S8.5_A4 and S8.1_A3 into declaration (both modes) and assignment tests (non-strict only) Part of issue tc39#35.
…ite-space} Make tests strict mode compatible by assigning result value to a separate variable. Part of issue tc39#35.
Add missing noStrict flags and variable declarations. Part of issue tc39#35.
What's left? :-D |
All tests work now in both modes! 😄 The only thing left is updating the python runner to use the new default. diff --git a/tools/packaging/test262.py b/tools/packaging/test262.py
index b9172b0..ed8939e 100755
--- a/tools/packaging/test262.py
+++ b/tools/packaging/test262.py
@@ -66,9 +66,7 @@ def BuildOptions():
help="Test only strict mode")
result.add_option("--non_strict_only", default=False, action="store_true",
help="Test only non-strict mode")
- # TODO: Once enough tests are made strict compat, change the default
- # to "both"
- result.add_option("--unmarked_default", default="non_strict",
+ result.add_option("--unmarked_default", default="both",
help="default mode for tests of unspecified strictness")
result.add_option("--logname", help="Filename to save stdout to")
result.add_option("--junitname", help="Filename to save test results in JUnit XML format") |
🎉 |
Done!!! 🍰 🍨 🎈 🎉 |
Per https://tc39.github.io/ecma402/#sec-canonicalizelanguagetag 6.2.3 CanonicalizeLanguageTag ( locale ) The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized form of the locale argument (which must be a String value that is a structurally valid Unicode BCP 47 Locale Identifier as verified by the IsStructurallyValidLanguageTag abstract operation). A conforming implementation shall take the steps specified in the “BCP 47 Language Tag to Unicode BCP 47 Locale Identifier” algorithm, from Unicode Technical Standard tc39#35 LDML § 3.3.1 BCP 47 Language Tag Conversion. And http://unicode.org/reports/tr35/#BCP_47_Language_Tag_Conversion " 2. If the BCP 47 primary language subtag matches the type attribute of a languageAlias element in Supplemental Data, replace the language subtag with the replacement value. If there are additional subtags in the replacement value, add them to the result, but only if there is no corresponding subtag already in the tag. " and https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml ... <languageAlias type="aar" replacement="aa" reason="overlong"/> <!-- [Afar] --> ... <languageAlias type="ces" replacement="cs" reason="overlong"/> <!-- [Czech] --> ... <languageAlias type="heb" replacement="he" reason="overlong"/> <!-- [Hebrew] -->
Per https://tc39.github.io/ecma402/#sec-canonicalizelanguagetag 6.2.3 CanonicalizeLanguageTag ( locale ) The CanonicalizeLanguageTag abstract operation returns the canonical and case-regularized form of the locale argument (which must be a String value that is a structurally valid Unicode BCP 47 Locale Identifier as verified by the IsStructurallyValidLanguageTag abstract operation). A conforming implementation shall take the steps specified in the “BCP 47 Language Tag to Unicode BCP 47 Locale Identifier” algorithm, from Unicode Technical Standard #35 LDML § 3.3.1 BCP 47 Language Tag Conversion. And http://unicode.org/reports/tr35/#BCP_47_Language_Tag_Conversion " 2. If the BCP 47 primary language subtag matches the type attribute of a languageAlias element in Supplemental Data, replace the language subtag with the replacement value. If there are additional subtags in the replacement value, add them to the result, but only if there is no corresponding subtag already in the tag. " and https://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalMetadata.xml ... <languageAlias type="aar" replacement="aa" reason="overlong"/> <!-- [Afar] --> ... <languageAlias type="ces" replacement="cs" reason="overlong"/> <!-- [Czech] --> ... <languageAlias type="heb" replacement="he" reason="overlong"/> <!-- [Hebrew] -->
If a test doesn't indicate that it's specifically for sloppy or strict mode it should be run in both. This change should be made at least for the web harness, but also perhaps for the python harness.
The text was updated successfully, but these errors were encountered: