aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMark Miller <erights@gmail.com>2011-09-14 12:43:53 -0700
committerMark Miller <erights@gmail.com>2011-09-14 12:43:53 -0700
commitaac6432ae1a9c9786693e94a606205b732b6e379 (patch)
tree7a3ddf304d98c958fc3c02dc5a1eff14f1215de4 /tools
parentd403f61b52b0690dc7fe66c43de7338abc0434fa (diff)
Updated converter to process the new IETCGlobalScope.js file.
Diffstat (limited to 'tools')
-rw-r--r--tools/converter/convert.js56
1 files changed, 54 insertions, 2 deletions
diff --git a/tools/converter/convert.js b/tools/converter/convert.js
index b9f47763a..8badc7a09 100644
--- a/tools/converter/convert.js
+++ b/tools/converter/convert.js
@@ -33,6 +33,31 @@
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)*/;
@@ -244,6 +269,8 @@
function normalizeProps(testRecord) {
if (!('strict_only' in testRecord) && testRecord.strict === 1) {
testRecord.strict_only = '';
+ }
+ if (testRecord.strict === 1) {
delete testRecord.strict;
}
@@ -276,6 +303,21 @@
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
* JSON test record.
*/
@@ -298,6 +340,16 @@
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.name;
testRecord.path = toRelPathStr(nextRelPath);
@@ -382,7 +434,7 @@
var outFilePath = outPath.concat([name]);
try {
platform.writeSpawn(
- [CONVERT_PATH],
+ [CONVERT_PATH].concat(EXTRA_GLOBAL_SCOPE_TESTS),
't262.show(t262.convertTest("' + toPathStr(inBase) +
'", "' + toRelPathStr(nextRelPath) + '"));',
void 0,
@@ -473,7 +525,7 @@
var outFilePath = outBase.concat([name]);
try {
platform.writeSpawn(
- [CONVERT_PATH],
+ [CONVERT_PATH].concat(EXTRA_GLOBAL_SCOPE_TESTS),
't262.showJSON(t262.buildSection("' + toPathStr(inBase) +
'", "' + toRelPathStr(nextRelPath) + '"));',
void 0,