Skip to content
Snippets Groups Projects
Commit aac6432a authored by Mark Miller's avatar Mark Miller
Browse files

Updated converter to process the new IETCGlobalScope.js file.

parent d403f61b
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,31 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment