baselines, diff fallback

This commit is contained in:
rbuckton 2017-01-07 15:09:33 -08:00
parent 3c7741fe20
commit 7c7712e024
6 changed files with 69 additions and 23 deletions

View file

@ -726,7 +726,7 @@ compileFile(
// Appending exports at the end of the server library // Appending exports at the end of the server library
var tsserverLibraryDefinitionFileContents = var tsserverLibraryDefinitionFileContents =
fs.readFileSync(tsserverLibraryDefinitionFile).toString() + fs.readFileSync(tsserverLibraryDefinitionFile).toString() +
"\r\nexport = ts;" + "\r\nexport = ts;" +
"\r\nexport as namespace ts;"; "\r\nexport as namespace ts;";
@ -851,24 +851,36 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
desc("Builds the test infrastructure using the built compiler"); desc("Builds the test infrastructure using the built compiler");
task("tests", ["local", run].concat(libraryTargets)); task("tests", ["local", run].concat(libraryTargets));
function exec(cmd, completeHandler, errorHandler) { function exec(cmd, completeHandler, errorHandler, opts) {
var stdio = opts && opts.stdio || {};
if (typeof stdio === "string") stdio = { stdout: stdio, stderr: stdio };
if (!stdio.stdout) stdio.stdout = "inherit";
if (!stdio.stderr) stdio.stderr = "inherit";
var stdout = "";
var stderr = "";
var ex = jake.createExec([cmd], { windowsVerbatimArguments: true }); var ex = jake.createExec([cmd], { windowsVerbatimArguments: true });
// Add listeners for output and error // Add listeners for output and error
ex.addListener("stdout", function (output) { ex.addListener("stdout", function (output) {
process.stdout.write(output); stdout += output;
if (stdio.stdout === "inherit") {
process.stdout.write(output);
}
}); });
ex.addListener("stderr", function (error) { ex.addListener("stderr", function (error) {
process.stderr.write(error); stderr += error;
if (stdio.stderr === "inherit") {
process.stderr.write(error);
}
}); });
ex.addListener("cmdEnd", function () { ex.addListener("cmdEnd", function () {
if (completeHandler) { if (completeHandler) {
completeHandler(); completeHandler(stdout, stderr);
} }
complete(); complete();
}); });
ex.addListener("error", function (e, status) { ex.addListener("error", function (e, status) {
if (errorHandler) { if (errorHandler) {
errorHandler(e, status); errorHandler(e, status, stdout, stderr);
} else { } else {
fail("Process exited with code " + status); fail("Process exited with code " + status);
} }
@ -1070,27 +1082,61 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFi
exec(cmd); exec(cmd);
}, { async: true }); }, { async: true });
function getDiffTool() { function getDiffTool(cb) {
var program = process.env['DIFF']; var program = process.env['DIFF'];
if (!program) { if (program) return cb(program);
return exec("git config diff.tool", onGetDiffTool, onError, { stdio: "redirect" });
function onGetDiffTool(stdout) {
if (stdout) stdout = stdout.trim();
if (stdout) return exec("git config difftool." + stdout + ".cmd", onGetDifftoolCmd, onError, { stdio: "redirect" });
return onError();
}
function onGetDifftoolCmd(stdout) {
if (stdout) stdout = stdout.trim();
if (stdout) return cb(stdout.trim());
return onError();
}
function onError() {
fail("Add the 'DIFF' environment variable to the path of the program you want to use."); fail("Add the 'DIFF' environment variable to the path of the program you want to use.");
} }
return program; }
function formatDiffTool(toolPath, leftPath, rightPath) {
return /\$(local|remote)/i.test(toolPath)
? toolPath.replace(/(\$local)|(\$remote)/gi, function (_, left, right) { return left ? leftPath : rightPath; })
: '"' + toolPath + '" "' + leftPath + '" "' + rightPath + '"';
}
function parseCommand(text) {
var re = /"([^"]*)"|[^"\s]+/g, args = [], m;
while (m = re.exec(text)) args.push(m[1] || m[0]);
return { cmd: args.shift(), args: args };
} }
// Baseline Diff // Baseline Diff
desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable"); desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable");
task('diff', function () { task('diff', function () {
var cmd = '"' + getDiffTool() + '" ' + refBaseline + ' ' + localBaseline; getDiffTool(function (tool) {
console.log(cmd); var cmd = formatDiffTool(tool, refBaseline, localBaseline);
exec(cmd); console.log(cmd);
var opts = parseCommand(cmd);
child_process.spawn(opts.cmd, opts.args, { detached: true }).unref();
complete();
});
}, { async: true }); }, { async: true });
desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable"); desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable");
task('diff-rwc', function () { task('diff-rwc', function () {
var cmd = '"' + getDiffTool() + '" ' + refRwcBaseline + ' ' + localRwcBaseline; getDiffTool(function (tool) {
console.log(cmd); var cmd = formatDiffTool(tool, refRwcBaseline, localRwcBaseline);
exec(cmd); console.log(cmd);
var opts = parseCommand(cmd);
child_process.spawn(opts.cmd, opts.args, { detached: true }).unref();
complete();
});
}, { async: true }); }, { async: true });
desc("Builds the test sources and automation in debug mode"); desc("Builds the test sources and automation in debug mode");

View file

@ -21457,7 +21457,7 @@ namespace ts {
return grammarErrorOnFirstToken(heritageClause, Diagnostics._0_clause_already_seen, "extends"); return grammarErrorOnFirstToken(heritageClause, Diagnostics._0_clause_already_seen, "extends");
} }
if (seenImplementsClause) { if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, Diagnostics._0_clause_must_precede_0_clause, "extends", "implements"); return grammarErrorOnFirstToken(heritageClause, Diagnostics._0_clause_must_precede_1_clause, "extends", "implements");
} }
if (heritageClause.types.length > 1) { if (heritageClause.types.length > 1) {
return grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class); return grammarErrorOnFirstToken(heritageClause.types[1], Diagnostics.Classes_can_only_extend_a_single_class);

View file

@ -515,7 +515,7 @@
"category": "Error", "category": "Error",
"code": 1172 "code": 1172
}, },
"'{0}' clause must precede '{0}' clause.": { "'{0}' clause must precede '{1}' clause.": {
"category": "Error", "category": "Error",
"code": 1173 "code": 1173
}, },

View file

@ -1,4 +1,4 @@
tests/cases/compiler/implementsClauseAlreadySeen.ts(4,22): error TS1175: 'implements' clause already seen. tests/cases/compiler/implementsClauseAlreadySeen.ts(4,22): error TS1172: 'implements' clause already seen.
==== tests/cases/compiler/implementsClauseAlreadySeen.ts (1 errors) ==== ==== tests/cases/compiler/implementsClauseAlreadySeen.ts (1 errors) ====
@ -7,6 +7,6 @@ tests/cases/compiler/implementsClauseAlreadySeen.ts(4,22): error TS1175: 'implem
} }
class D implements C implements C { class D implements C implements C {
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS1175: 'implements' clause already seen. !!! error TS1172: 'implements' clause already seen.
baz() { } baz() { }
} }

View file

@ -1,5 +1,5 @@
tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,20): error TS2304: Cannot find name 'A'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,20): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,22): error TS1175: 'implements' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts(1,22): error TS1172: 'implements' clause already seen.
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts (2 errors) ==== ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration2.ts (2 errors) ====
@ -7,5 +7,5 @@ tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarat
~ ~
!!! error TS2304: Cannot find name 'A'. !!! error TS2304: Cannot find name 'A'.
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS1175: 'implements' clause already seen. !!! error TS1172: 'implements' clause already seen.
} }

View file

@ -1,6 +1,6 @@
tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,17): error TS2304: Cannot find name 'A'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,17): error TS2304: Cannot find name 'A'.
tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,30): error TS2304: Cannot find name 'B'. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,30): error TS2304: Cannot find name 'B'.
tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,32): error TS1175: 'implements' clause already seen. tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts(1,32): error TS1172: 'implements' clause already seen.
==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts (3 errors) ==== ==== tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclaration5.ts (3 errors) ====
@ -10,5 +10,5 @@ tests/cases/conformance/parser/ecmascript5/ClassDeclarations/parserClassDeclarat
~ ~
!!! error TS2304: Cannot find name 'B'. !!! error TS2304: Cannot find name 'B'.
~~~~~~~~~~ ~~~~~~~~~~
!!! error TS1175: 'implements' clause already seen. !!! error TS1172: 'implements' clause already seen.
} }