Remove intentionally unused variables

This commit is contained in:
Nathan Shively-Sanders 2016-05-24 11:22:25 -07:00
parent 7bbce05d61
commit 9865b48d0f
3 changed files with 13 additions and 19 deletions

View File

@ -1059,9 +1059,7 @@ import b = require("./moduleB.ts");
const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics();
assert.equal(diagnostics1.length, 1, "expected one diagnostic");
/* tslint:disable no-unused-variable */
const program2 = createProgram(names, {}, compilerHost, program1);
/* tslint:enable no-unused-variable */
createProgram(names, {}, compilerHost, program1);
assert.isTrue(program1.structureIsReused);
const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics();
assert.equal(diagnostics2.length, 1, "expected one diagnostic");

View File

@ -210,7 +210,6 @@ namespace ts {
}
describe("Reuse program structure", () => {
/* tslint:disable no-unused-variable */
const target = ScriptTarget.Latest;
const files = [
{ name: "a.ts", text: SourceText.New(
@ -248,7 +247,7 @@ namespace ts {
it("fails if change affects tripleslash references", () => {
const program_1 = newProgram(files, ["a.ts"], { target });
const program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
updateProgram(program_1, ["a.ts"], { target }, files => {
const newReferences = `/// <reference path='b.ts'/>
/// <reference path='c.ts'/>
`;
@ -259,7 +258,7 @@ namespace ts {
it("fails if change affects imports", () => {
const program_1 = newProgram(files, ["a.ts"], { target });
const program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
updateProgram(program_1, ["a.ts"], { target }, files => {
files[2].text = files[2].text.updateImportsAndExports("import x from 'b'");
});
assert.isTrue(!program_1.structureIsReused);
@ -267,7 +266,7 @@ namespace ts {
it("fails if change affects type directives", () => {
const program_1 = newProgram(files, ["a.ts"], { target });
const program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
updateProgram(program_1, ["a.ts"], { target }, files => {
const newReferences = `
/// <reference path='b.ts'/>
/// <reference path='non-existing-file.ts'/>
@ -279,19 +278,19 @@ namespace ts {
it("fails if module kind changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS });
const program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
it("fails if rootdir changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" });
const program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
it("fails if config path changes", () => {
const program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" });
const program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0);
updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
@ -360,7 +359,7 @@ namespace ts {
assert.isTrue(!program_2.structureIsReused);
checkResolvedTypeDirectivesCache(program_3, "/a.ts", undefined);
const program_4 = updateProgram(program_3, ["/a.ts"], options, files => {
updateProgram(program_3, ["/a.ts"], options, files => {
const newReferences = `/// <reference types="typedefs"/>
/// <reference types="typedefs2"/>
`;
@ -369,7 +368,6 @@ namespace ts {
assert.isTrue(!program_3.structureIsReused);
checkResolvedTypeDirectivesCache(program_1, "/a.ts", { "typedefs": { resolvedFileName: "/types/typedefs/index.d.ts", primary: true } });
});
/* tslint:enable no-unused-variable */
});
describe("host is optional", () => {

View File

@ -1,7 +1,6 @@
///<reference path='..\..\..\..\src\harness\harness.ts' />
describe("DocumentRegistry", () => {
/* tslint:disable no-unused-variable */
it("documents are shared between projects", () => {
const documentRegistry = ts.createDocumentRegistry();
const defaultCompilerOptions = ts.getDefaultCompilerOptions();
@ -47,7 +46,7 @@ describe("DocumentRegistry", () => {
const defaultCompilerOptions = ts.getDefaultCompilerOptions();
// Simulate one LS getting the document.
const f1 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "1");
documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "1");
// Simulate another LS getting the document at another version.
const f2 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "2");
@ -66,16 +65,15 @@ describe("DocumentRegistry", () => {
snapshot.getChangeRange = old => ts.createTextChangeRange(ts.createTextSpan(0, contents.length), contents.length);
// Simulate one LS getting the document.
const f1 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1");
documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1");
// Simulate another LS getting that document.
const f2 = documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1");
documentRegistry.acquireDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "1");
// Now LS1 updates their document.
const f3 = documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "2");
documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "2");
// Now LS2 tries to update their document.
const f4 = documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "3");
documentRegistry.updateDocument("file1.ts", defaultCompilerOptions, snapshot, /* version */ "3");
});
/* tslint:enable no-unused-variable */
});