mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-18 12:21:37 -06:00
Add testcase - generating declaration file results in more errors in ts file
This commit is contained in:
parent
9f96f47a4f
commit
11b270f6ca
@ -535,6 +535,16 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputContentsForCurrentFile(expected: { fileName: string; content: string; }[]): void {
|
||||
let emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
this.taoInvalidReason = "verifyGetEmitOutputContentsForCurrentFile impossible";
|
||||
assert.equal(emit.outputFiles.length, expected.length, "Number of emit output files");
|
||||
for (let i = 0; i < emit.outputFiles.length; i++) {
|
||||
assert.equal(emit.outputFiles[i].name, expected[i].fileName, "FileName");
|
||||
assert.equal(emit.outputFiles[i].text, expected[i].content, "Content");
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListContains(symbol: string, text?: string, documentation?: string, kind?: string) {
|
||||
this.scenarioActions.push("<ShowCompletionList />");
|
||||
this.scenarioActions.push(`<VerifyCompletionContainsItem ItemName="${symbol}"/>`);
|
||||
|
||||
@ -314,6 +314,10 @@ module FourSlashInterface {
|
||||
FourSlash.currentTestState.verifyGetEmitOutputForCurrentFile(expected);
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputContentsForCurrentFile(expected: { fileName: string; content: string; }[]): void {
|
||||
FourSlash.currentTestState.verifyGetEmitOutputContentsForCurrentFile(expected);
|
||||
}
|
||||
|
||||
public currentParameterHelpArgumentNameIs(name: string) {
|
||||
FourSlash.currentTestState.verifyCurrentParameterHelpName(name);
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @declaration: true
|
||||
// @out: out.js
|
||||
// @jsExtensions: js
|
||||
// @Filename: b.js
|
||||
// @emitThisFile: true
|
||||
////function foo() { return 10; }/*1*/
|
||||
|
||||
// @Filename: a.ts
|
||||
// @emitThisFile: true
|
||||
////function foo() { return 30; }/*2*/
|
||||
|
||||
goTo.marker("2");
|
||||
verify.getSemanticDiagnostics("[]");
|
||||
verify.verifyGetEmitOutputContentsForCurrentFile([
|
||||
{ fileName: "out.js", content: "function foo() { return 10; }\r\nfunction foo() { return 30; }\r\n" },
|
||||
{ fileName: "out.d.ts", content: "" }]);
|
||||
goTo.marker("2");
|
||||
verify.getSemanticDiagnostics('[\n {\n "message": "Duplicate function implementation.",\n "start": 9,\n "length": 3,\n "category": "error",\n "code": 2393\n }\n]');
|
||||
Loading…
x
Reference in New Issue
Block a user