This commit is contained in:
David Fugate 2011-09-22 12:56:52 -07:00
commit 124d0c7848
29 changed files with 107 additions and 2 deletions

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter07/7.6/7.6.1/7.6.1.2-1gs.js * @path chapter07/7.6/7.6.1/7.6.1.2-1gs.js
* @description Strict Mode - SyntaxError is thrown when FutureReservedWord 'implements' occurs in strict mode code
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter07/7.8/7.8.3/7.8.3-1gs.js * @path chapter07/7.8/7.8.3/7.8.3-1gs.js
* @description Strict Mode - octal extension(010) is forbidden in strict mode
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,6 +2,8 @@
/** /**
* @path chapter07/7.8/7.8.5/7.8.5-1gs.js * @path chapter07/7.8/7.8.5/7.8.5-1gs.js
* @description Empty literal RegExp should result in a SyntaxError
* @negative EarlyErrorRePat
*/ */
throw NotEarlyError; throw NotEarlyError;

View File

@ -2,6 +2,7 @@
/** /**
* @path chapter07/7.8/7.8.5/7.8.5-2gs.js * @path chapter07/7.8/7.8.5/7.8.5-2gs.js
* @description Empty dynamic RegExp should not result in a SyntaxError
*/ */
var re = new RegExp(""); var re = new RegExp("");

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter08/8.7/8.7.2/8.7.2-3-a-1gs.js * @path chapter08/8.7/8.7.2/8.7.2-3-a-1gs.js
* @description Strict Mode - ReferenceError is thrown if LeftHandSide evaluate to an unresolvable Reference
* @strict_only * @strict_only
* @negative .
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter08/8.7/8.7.2/8.7.2-3-a-2gs.js * @path chapter08/8.7/8.7.2/8.7.2-3-a-2gs.js
* @description Strict Mode - 'runtime' error is thrown before LeftHandSide evaluates to an unresolvable Reference
* @strict_only * @strict_only
* @negative NotEarlyErrorString
*/ */

View File

@ -2,6 +2,9 @@
/** /**
* @path chapter10/10.1/10.1.1/10.1.1-2gs.js * @path chapter10/10.1/10.1.1/10.1.1-2gs.js
* @description Strict Mode - Use Strict Directive Prologue is ''use strict'' which lost the last character ';'
* @strict_only
* @negative EarlyErrorRePat
*/ */
"use strict" "use strict"

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter10/10.1/10.1.1/10.1.1-5gs.js * @path chapter10/10.1/10.1.1/10.1.1-5gs.js
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears at the start of the code
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter10/10.1/10.1.1/10.1.1-8gs.js * @path chapter10/10.1/10.1.1/10.1.1-8gs.js
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter10/10.4/10.4.2/10.4.2.1-1gs.js * @path chapter10/10.4/10.4.2/10.4.2.1-1gs.js
* @description Strict Mode - eval code cannot instantiate variable in the variable environment of the calling context that invoked the eval if the code of the calling context is strict code
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -20,6 +20,7 @@
/** /**
* @path chapter10/10.4/10.4.3/10.4.3-1-7gs.js * @path chapter10/10.4/10.4.3/10.4.3-1-7gs.js
* @description Strict - checking 'this' from a global scope (FunctionDeclaration defined within strict mode)
* @strict_only * @strict_only
*/ */

View File

@ -20,6 +20,8 @@
/** /**
* @path chapter10/10.4/10.4.3/10.4.3-1-8gs.js * @path chapter10/10.4/10.4.3/10.4.3-1-8gs.js
* @description Strict - checking 'this' from a global scope (FunctionDeclaration includes strict directive prologue)
* @strict_only
*/ */
function f() { function f() {

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter10/10.5/10.5-1gs.js * @path chapter10/10.5/10.5-1gs.js
* @description Strict Mode - arguments cannot be assigned to in a strict function
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,6 +2,7 @@
/** /**
* @path chapter10/10.6/10.6-1gs.js * @path chapter10/10.6/10.6-1gs.js
* @description Strict Mode - arguments.callee cannot be accessed in a strict function, but does not throw an early error
* @strict_only * @strict_only
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter10/10.6/10.6-2gs.js * @path chapter10/10.6/10.6-2gs.js
* @description Strict Mode - arguments.callee cannot be accessed in a strict function
* @strict_only * @strict_only
* @negative .
*/ */

View File

@ -2,6 +2,7 @@
/** /**
* @path chapter11/11.1/11.1.1/11.1.1-1gs.js * @path chapter11/11.1/11.1.1/11.1.1-1gs.js
* @description Strict Mode - 'this' object at the global scope is not undefined
* @strict_only * @strict_only
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter11/11.13/11.13.2/11.13.2-6-1gs.js * @path chapter11/11.13/11.13.2/11.13.2-6-1gs.js
* @description Strict Mode - SyntaxError is throw if the identifier eval appears as the LeftHandSideExpression of a Compound Assignment operator(*=)
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter11/11.3/11.3.1/11.3.1-2-1gs.js * @path chapter11/11.3/11.3.1/11.3.1-2-1gs.js
* @description Strict Mode - SyntaxError is throw if the identifier arguments appear as a PostfixExpression(arguments++)
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter11/11.4/11.4.5/11.4.5-2-2gs.js * @path chapter11/11.4/11.4.5/11.4.5-2-2gs.js
* @description Strict Mode - SyntaxError is throw if the UnaryExpression operated upon by a Prefix Increment operator(--arguments)
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter12/12.10/12.10.1/12.10.1-11gs.js * @path chapter12/12.10/12.10.1/12.10.1-11gs.js
* @description Strict Mode - SyntaxError is thrown when using with statement
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter12/12.14/12.14.1/12.14.1-1gs.js * @path chapter12/12.14/12.14.1/12.14.1-1gs.js
* @description Strict Mode - SyntaxError is thrown if a TryStatement with a Catch occurs within strict code and the Identifier of the Catch production is eval
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter13/13.0/13_4-17gs.js * @path chapter13/13.0/13_4-17gs.js
* @description Strict Mode - SourceElements is evaluated as strict mode code when a Function constructor is contained in strict mode code
* @strict_only * @strict_only
* @negative NotEarlyErrorString
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter13/13.0/13_4-5gs.js * @path chapter13/13.0/13_4-5gs.js
* @description Strict Mode - SourceElements is evaluated as strict mode code when a FunctionDeclaration is contained in strict mode code
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -20,6 +20,7 @@
/** /**
* @path chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-625gs.js * @path chapter15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-625gs.js
* @description Globally declared variable should take precedence over Object.prototype property of the same name
*/ */
Object.defineProperty(Object.prototype, Object.defineProperty(Object.prototype,

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-10-4gs.js * @path chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-10-4gs.js
* @description Strict Mode - SyntaxError is thrown if a function using the Function constructor has two identical parameters in (global) strict mode
* @strict_only * @strict_only
* @negative NotEarlyErrorString
*/ */

View File

@ -2,6 +2,9 @@
/** /**
* @path chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-10-6gs.js * @path chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-10-6gs.js
* @description Strict Mode - SyntaxError is thrown if a function using the Function constructor has two identical parameters in (local) strict mode
* @strict_only
* @negative NotEarlyErrorString
*/ */
throw NotEarlyError; throw NotEarlyError;

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter15/15.3/15.3.5/15.3.5-1gs.js * @path chapter15/15.3/15.3.5/15.3.5-1gs.js
* @description StrictMode - error is thrown when reading the 'caller' property of a function object
* @strict_only * @strict_only
* @negative NotEarlyErrorString
*/ */

View File

@ -2,7 +2,9 @@
/** /**
* @path chapter15/15.3/15.3.5/15.3.5-2gs.js * @path chapter15/15.3/15.3.5/15.3.5-2gs.js
* @description StrictMode - error is thrown when reading the 'caller' property of a function object
* @strict_only * @strict_only
* @negative EarlyErrorRePat
*/ */

View File

@ -33,6 +33,31 @@
var CONVERT_PATH = platform.CONVERTER_DIR.concat('convert.js'); var CONVERT_PATH = platform.CONVERTER_DIR.concat('convert.js');
/**
* Extra in the sense that they are not redundant with the source,
* but add information that should be present in the converted
* source. So not test/suite/SputnikGlobalScope.js, since that is
* actually derived from sources.
*/
var EXTRA_GLOBAL_SCOPE_TESTS = [
['test', 'suite', 'IETCGlobalScope.js']
];
/**
* Try prepending this to a relPath if necessary to get an index
* into EXTRA_GLOBAL_SCOPE_TESTS.
*/
var EXTRANEOUS_PREFIXES = ['TestCases'];
/**
* Prepare for reading in the EXTRA_GLOBAL_SCOPE_TESTS, suppressing
* the "new Array()" that inappropriately still appears in
* IETCGlobalScope.js
*/
global.GlobalScopeTests = global.GlobalScopeTests || {};
global.EarlyErrorRePat = 'EarlyErrorRePat';
global.NotEarlyErrorString = 'NotEarlyErrorString';
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
var headerPattern = /(?:(?:\/\/.*)?\s*\n)*/; var headerPattern = /(?:(?:\/\/.*)?\s*\n)*/;
@ -244,6 +269,8 @@
function normalizeProps(testRecord) { function normalizeProps(testRecord) {
if (!('strict_only' in testRecord) && testRecord.strict === 1) { if (!('strict_only' in testRecord) && testRecord.strict === 1) {
testRecord.strict_only = ''; testRecord.strict_only = '';
}
if (testRecord.strict === 1) {
delete testRecord.strict; delete testRecord.strict;
} }
@ -275,6 +302,21 @@
} }
t262.normalizeProps = normalizeProps; t262.normalizeProps = normalizeProps;
/**
* If relPath is represented in the EXTRA_GLOBAL_SCOPE_TESTS,
* retrieve the corresponding record. Otherwise, return undefined.
*/
function getGlobalScopeRecord(relPath) {
var key = toRelPathStr(relPath);
var val = global.GlobalScopeTests[key];
if (!val) {
key = toRelPathStr(EXTRANEOUS_PREFIXES.concat(relPath));
val = global.GlobalScopeTests[key];
}
return val;
}
t262.getGlobalScopeRecord = getGlobalScopeRecord;
/** /**
* Parses the source of a test262 test case file into a normalized * Parses the source of a test262 test case file into a normalized
* JSON test record. * JSON test record.
@ -298,6 +340,16 @@
testRecord.test = envelope.rest; testRecord.test = envelope.rest;
} }
} }
var globalScopeRecord = getGlobalScopeRecord(nextRelPath);
if (globalScopeRecord) {
forEach(keys(globalScopeRecord), function(key) {
if (!(key in testRecord) && key !== 'precondition') {
testRecord[key] = globalScopeRecord[key];
}
});
}
delete testRecord.id; delete testRecord.id;
delete testRecord.name; delete testRecord.name;
testRecord.path = toRelPathStr(nextRelPath); testRecord.path = toRelPathStr(nextRelPath);
@ -382,7 +434,7 @@
var outFilePath = outPath.concat([name]); var outFilePath = outPath.concat([name]);
try { try {
platform.writeSpawn( platform.writeSpawn(
[CONVERT_PATH], [CONVERT_PATH].concat(EXTRA_GLOBAL_SCOPE_TESTS),
't262.show(t262.convertTest("' + toPathStr(inBase) + 't262.show(t262.convertTest("' + toPathStr(inBase) +
'", "' + toRelPathStr(nextRelPath) + '"));', '", "' + toRelPathStr(nextRelPath) + '"));',
void 0, void 0,
@ -473,7 +525,7 @@
var outFilePath = outBase.concat([name]); var outFilePath = outBase.concat([name]);
try { try {
platform.writeSpawn( platform.writeSpawn(
[CONVERT_PATH], [CONVERT_PATH].concat(EXTRA_GLOBAL_SCOPE_TESTS),
't262.showJSON(t262.buildSection("' + toPathStr(inBase) + 't262.showJSON(t262.buildSection("' + toPathStr(inBase) +
'", "' + toRelPathStr(nextRelPath) + '"));', '", "' + toRelPathStr(nextRelPath) + '"));',
void 0, void 0,