Skip to content

Commit 9f7782d

Browse files
Added error 'prologue' to each error baseline.
1 parent ee86f8b commit 9f7782d

File tree

2,213 files changed

+18739
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,213 files changed

+18739
-22
lines changed

src/harness/compilerRunner.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ class CompilerBaselineRunner extends RunnerBase {
156156
return file.writeByteOrderMark ? "\u00EF\u00BB\u00BF" : "";
157157
}
158158

159-
function getErrorBaseline(toBeCompiled: { unitName: string; content: string }[],
160-
otherFiles: { unitName: string; content: string }[],
161-
result: Harness.Compiler.CompilerResult
162-
) {
159+
function getErrorBaseline(toBeCompiled: { unitName: string; content: string }[], otherFiles: { unitName: string; content: string }[], result: Harness.Compiler.CompilerResult) {
163160
return Harness.Compiler.getErrorBaseline(toBeCompiled.concat(otherFiles), result.errors);
164161
}
165162

@@ -168,7 +165,7 @@ class CompilerBaselineRunner extends RunnerBase {
168165
if (this.errors) {
169166
Harness.Baseline.runBaseline('Correct errors for ' + fileName, justName.replace(/\.ts$/, '.errors.txt'), (): string => {
170167
if (result.errors.length === 0) return null;
171-
168+
172169
return getErrorBaseline(toBeCompiled, otherFiles, result);
173170
});
174171
}

src/harness/harness.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,7 @@ module Harness {
807807
return errorOutput;
808808
}
809809

810-
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[],
811-
diagnostics: HarnessDiagnostic[]
812-
) {
810+
export function getErrorBaseline(inputFiles: { unitName: string; content: string }[], diagnostics: HarnessDiagnostic[]) {
813811

814812
var outputLines: string[] = [];
815813
// Count up all the errors we find so we don't miss any
@@ -826,7 +824,7 @@ module Harness {
826824
totalErrorsReported++;
827825
}
828826

829-
// Report global errors:
827+
// Report global errors
830828
var globalErrors = diagnostics.filter(err => !err.filename);
831829
globalErrors.forEach(err => outputErrorText(err));
832830

@@ -896,7 +894,8 @@ module Harness {
896894
// Verify we didn't miss any errors in total
897895
assert.equal(totalErrorsReported, diagnostics.length, 'total number of errors');
898896

899-
return outputLines.join('\r\n');
897+
return minimalDiagnosticsToString(diagnostics) +
898+
sys.newLine + sys.newLine + outputLines.join('\r\n');
900899
}
901900

902901
/* TODO: Delete?

src/harness/projectsRunner.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Test case is json of below type in tests/cases/project/
55
interface ProjectRunnerTestCase {
66
scenario: string;
7-
projectRoot: string; // project where it lives - this also is the current dictory when compiling
7+
projectRoot: string; // project where it lives - this also is the current directory when compiling
88
inputFiles: string[]; // list of input files to be given to program
99
out?: string; // --out
1010
outDir?: string; // --outDir
@@ -22,7 +22,7 @@ interface ProjectRunnerTestCase {
2222
interface ProjectRunnerTestCaseResolutionInfo extends ProjectRunnerTestCase {
2323
// Apart from actual test case the results of the resolution
2424
resolvedInputFiles: string[]; // List of files that were asked to read by compiler
25-
emittedFiles: string[]; // List of files that wre emitted by the compiler
25+
emittedFiles: string[]; // List of files that were emitted by the compiler
2626
}
2727

2828
interface BatchCompileProjectTestCaseEmittedFile extends Harness.Compiler.GeneratedFile {
@@ -69,7 +69,7 @@ class ProjectRunner extends RunnerBase {
6969
testCase = <ProjectRunnerTestCase>JSON.parse(testFileText);
7070
}
7171
catch (e) {
72-
assert(false, "Testcase: " + testCaseFileName + " doesnt not contain valid json format: " + e.message);
72+
assert(false, "Testcase: " + testCaseFileName + " does not contain valid json format: " + e.message);
7373
}
7474
var testCaseJustName = testCaseFileName.replace(/^.*[\\\/]/, '').replace(/\.json/, "");
7575

@@ -87,7 +87,7 @@ class ProjectRunner extends RunnerBase {
8787
}
8888

8989
// When test case output goes to tests/baselines/local/projectOutput/testCaseName/moduleKind/
90-
// We have these two separate locations because when compairing baselines the baseline verifier will delete the existing file
90+
// We have these two separate locations because when comparing baselines the baseline verifier will delete the existing file
9191
// so even if it was created by compiler in that location, the file will be deleted by verified before we can read it
9292
// so lets keep these two locations separate
9393
function getProjectOutputFolder(filename: string, moduleKind: ts.ModuleKind) {
@@ -228,7 +228,7 @@ class ProjectRunner extends RunnerBase {
228228

229229
var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, getCurrentDirectory(), false);
230230
if (ts.isRootedDiskPath(diskRelativeName) || diskRelativeName.substr(0, 3) === "../") {
231-
// If the generated output file recides in the parent folder or is rooted path,
231+
// If the generated output file resides in the parent folder or is rooted path,
232232
// we need to instead create files that can live in the project reference folder
233233
// but make sure extension of these files matches with the filename the compiler asked to write
234234
diskRelativeName = "diskFile" + nonSubfolderDiskFiles++ +
@@ -299,13 +299,11 @@ class ProjectRunner extends RunnerBase {
299299
return { unitName: sourceFile.filename, content: sourceFile.text };
300300
});
301301
var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error));
302-
var errors = Harness.Compiler.minimalDiagnosticsToString(diagnostics);
303-
errors += sys.newLine + sys.newLine + Harness.Compiler.getErrorBaseline(inputFiles, diagnostics);
304302

305-
return errors;
303+
return Harness.Compiler.getErrorBaseline(inputFiles, diagnostics);
306304
}
307305

308-
describe('Compiling project for ' + testCase.scenario +': testcase ' + testCaseFileName, () => {
306+
describe('Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName, () => {
309307
function verifyCompilerResults(compilerResult: BatchCompileProjectTestCaseResult) {
310308
function getCompilerResolutionInfo() {
311309
var resolutionInfo: ProjectRunnerTestCaseResolutionInfo = {

src/harness/rwcRunner.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,7 @@ module RWC {
152152
return null;
153153
}
154154

155-
return Harness.Compiler.minimalDiagnosticsToString(compilerResult.errors) +
156-
sys.newLine + sys.newLine +
157-
Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors);
155+
return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors);
158156
}, false, baselineOpts);
159157
});
160158

tests/baselines/reference/ArrowFunction1.errors.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts(1,13): error TS1110: Type expected.
2+
3+
14
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction1.ts (1 errors) ====
25
var v = (a: ) => {
36
~

tests/baselines/reference/ArrowFunction2.errors.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,14): error TS1009: Trailing comma not allowed.
2+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts(1,13): error TS2304: Cannot find name 'b'.
3+
4+
15
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction2.ts (2 errors) ====
26
var v = (a: b,) => {
37
~

tests/baselines/reference/ArrowFunction3.errors.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,12): error TS1005: ',' expected.
2+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,14): error TS1005: ';' expected.
3+
tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts(1,10): error TS2304: Cannot find name 'a'.
4+
5+
16
==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/ArrowFunctions/ArrowFunction3.ts (3 errors) ====
27
var v = (a): => {
38
~

tests/baselines/reference/ArrowFunctionExpression1.errors.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
tests/cases/compiler/ArrowFunctionExpression1.ts(1,10): error TS2369: A parameter property is only allowed in a constructor implementation.
2+
3+
14
==== tests/cases/compiler/ArrowFunctionExpression1.ts (1 errors) ====
25
var v = (public x: string) => { };
36
~~~~~~~~~~~~~~~~

tests/baselines/reference/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.errors.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(10,19): error TS2304: Cannot find name 'T'.
2+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(20,12): error TS2304: Cannot find name 'T'.
3+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(22,23): error TS2304: Cannot find name 'T'.
4+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(35,26): error TS2304: Cannot find name 'T'.
5+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts(46,15): error TS2304: Cannot find name 'T'.
6+
7+
18
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModuleMemberThatUsesClassTypeParameter.ts (5 errors) ====
29
// all expected to be errors
310

tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.errors.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts(10,21): error TS2300: Duplicate identifier 'fn'.
2+
3+
14
==== tests/cases/conformance/internalModules/DeclarationMerging/ClassAndModuleThatMergeWithModulesExportedGenericFunctionAndGenericClassStaticFunctionOfTheSameName.ts (1 errors) ====
25
class clodule<T> {
36
id: string;

0 commit comments

Comments
 (0)