diff --git a/src/harness/unittests/extractFunctions.ts b/src/harness/unittests/extractFunctions.ts index 4e7cba9606c..522ea7b1293 100644 --- a/src/harness/unittests/extractFunctions.ts +++ b/src/harness/unittests/extractFunctions.ts @@ -1,8 +1,8 @@ /// namespace ts { - describe("extractMethods", () => { - testExtractMethod("extractMethod1", + describe("extractFunctions", () => { + testExtractFunction("extractFunction1", `namespace A { let x = 1; function foo() { @@ -18,7 +18,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod2", + testExtractFunction("extractFunction2", `namespace A { let x = 1; function foo() { @@ -32,7 +32,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod3", + testExtractFunction("extractFunction3", `namespace A { function foo() { } @@ -45,7 +45,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod4", + testExtractFunction("extractFunction4", `namespace A { function foo() { } @@ -60,7 +60,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod5", + testExtractFunction("extractFunction5", `namespace A { let x = 1; export function foo() { @@ -76,7 +76,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod6", + testExtractFunction("extractFunction6", `namespace A { let x = 1; export function foo() { @@ -92,7 +92,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod7", + testExtractFunction("extractFunction7", `namespace A { let x = 1; export namespace C { @@ -110,7 +110,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod8", + testExtractFunction("extractFunction8", `namespace A { let x = 1; namespace B { @@ -120,7 +120,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod9", + testExtractFunction("extractFunction9", `namespace A { export interface I { x: number }; namespace B { @@ -130,7 +130,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod10", + testExtractFunction("extractFunction10", `namespace A { export interface I { x: number }; class C { @@ -141,7 +141,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod11", + testExtractFunction("extractFunction11", `namespace A { let y = 1; class C { @@ -154,7 +154,7 @@ namespace ts { } } }`); - testExtractMethod("extractMethod12", + testExtractFunction("extractFunction12", `namespace A { let y = 1; class C { @@ -174,7 +174,7 @@ namespace ts { // In all cases, we could use type inference, rather than passing explicit type arguments. // Note the inclusion of arrow functions to ensure that some type parameters are not from // targetable scopes. - testExtractMethod("extractMethod13", + testExtractFunction("extractFunction13", `(u1a: U1a, u1b: U1b) => { function F1(t1a: T1a, t1b: T1b) { (u2a: U2a, u2b: U2b) => { @@ -192,7 +192,7 @@ namespace ts { }`); // This test is descriptive, rather than normative. The current implementation // doesn't handle type parameter shadowing. - testExtractMethod("extractMethod14", + testExtractFunction("extractFunction14", `function F(t1: T) { function G(t2: T) { [#|t1.toString(); @@ -200,38 +200,38 @@ namespace ts { } }`); // Confirm that the constraint is preserved. - testExtractMethod("extractMethod15", + testExtractFunction("extractFunction15", `function F(t1: T) { function G(t2: U) { [#|t2.toString();|] } }`); // Confirm that the contextual type of an extracted expression counts as a use. - testExtractMethod("extractMethod16", + testExtractFunction("extractFunction16", `function F() { const array: T[] = [#|[]|]; }`); // Class type parameter - testExtractMethod("extractMethod17", + testExtractFunction("extractFunction17", `class C { M(t1: T1, t2: T2) { [#|t1.toString()|]; } }`); - // Method type parameter - testExtractMethod("extractMethod18", + // Function type parameter + testExtractFunction("extractFunction18", `class C { M(t1: T1, t2: T2) { [#|t1.toString()|]; } }`); // Coupled constraints - testExtractMethod("extractMethod19", + testExtractFunction("extractFunction19", `function F(v: V) { [#|v.toString()|]; }`); - testExtractMethod("extractMethod20", + testExtractFunction("extractFunction20", `const _ = class { a() { [#|let a1 = { x: 1 }; @@ -239,14 +239,14 @@ namespace ts { } }`); // Write + void return - testExtractMethod("extractMethod21", + testExtractFunction("extractFunction21", `function foo() { let x = 10; [#|x++; return;|] }`); // Return in finally block - testExtractMethod("extractMethod22", + testExtractFunction("extractFunction22", `function test() { try { } @@ -255,7 +255,7 @@ namespace ts { } }`); // Extraction position - namespace - testExtractMethod("extractMethod23", + testExtractFunction("extractFunction23", `namespace NS { function M1() { } function M2() { @@ -264,7 +264,7 @@ namespace ts { function M3() { } }`); // Extraction position - function - testExtractMethod("extractMethod24", + testExtractFunction("extractFunction24", `function Outer() { function M1() { } function M2() { @@ -273,14 +273,14 @@ namespace ts { function M3() { } }`); // Extraction position - file - testExtractMethod("extractMethod25", + testExtractFunction("extractFunction25", `function M1() { } function M2() { [#|return 1;|] } function M3() { }`); // Extraction position - class without ctor - testExtractMethod("extractMethod26", + testExtractFunction("extractFunction26", `class C { M1() { } M2() { @@ -289,7 +289,7 @@ function M3() { }`); M3() { } }`); // Extraction position - class with ctor in middle - testExtractMethod("extractMethod27", + testExtractFunction("extractFunction27", `class C { M1() { } M2() { @@ -299,7 +299,7 @@ function M3() { }`); M3() { } }`); // Extraction position - class with ctor at end - testExtractMethod("extractMethod28", + testExtractFunction("extractFunction28", `class C { M1() { } M2() { @@ -309,7 +309,7 @@ function M3() { }`); constructor() { } }`); // Shorthand property names - testExtractMethod("extractMethod29", + testExtractFunction("extractFunction29", `interface UnaryExpression { kind: "Unary"; operator: string; @@ -328,12 +328,12 @@ function parsePrimaryExpression(): any { throw "Not implemented"; }`); // Type parameter as declared type - testExtractMethod("extractMethod30", + testExtractFunction("extractFunction30", `function F() { [#|let t: T;|] }`); // Return in nested function - testExtractMethod("extractMethod31", + testExtractFunction("extractFunction31", `namespace N { export const value = 1; @@ -346,7 +346,7 @@ function parsePrimaryExpression(): any { } }`); // Return in nested class - testExtractMethod("extractMethod32", + testExtractFunction("extractFunction32", `namespace N { export const value = 1; @@ -360,20 +360,20 @@ function parsePrimaryExpression(): any { } }`); // Selection excludes leading trivia of declaration - testExtractMethod("extractMethod33", + testExtractFunction("extractFunction33", `function F() { [#|function G() { }|] }`); // TODO (acasey): handle repeated substitution -// testExtractMethod("extractMethod_RepeatedSubstitution", +// testExtractFunction("extractFunction_RepeatedSubstitution", // `namespace X { // export const j = 10; // export const y = [#|j * j|]; // }`); }); - function testExtractMethod(caption: string, text: string) { - testExtractSymbol(caption, text, "extractMethod", Diagnostics.Extract_function); + function testExtractFunction(caption: string, text: string) { + testExtractSymbol(caption, text, "extractFunction", Diagnostics.Extract_function); } } diff --git a/tests/baselines/reference/extractMethod/extractMethod1.ts b/tests/baselines/reference/extractFunction/extractFunction1.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod1.ts rename to tests/baselines/reference/extractFunction/extractFunction1.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod10.ts b/tests/baselines/reference/extractFunction/extractFunction10.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod10.ts rename to tests/baselines/reference/extractFunction/extractFunction10.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod11.ts b/tests/baselines/reference/extractFunction/extractFunction11.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod11.ts rename to tests/baselines/reference/extractFunction/extractFunction11.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod12.ts b/tests/baselines/reference/extractFunction/extractFunction12.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod12.ts rename to tests/baselines/reference/extractFunction/extractFunction12.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod13.ts b/tests/baselines/reference/extractFunction/extractFunction13.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod13.ts rename to tests/baselines/reference/extractFunction/extractFunction13.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod14.ts b/tests/baselines/reference/extractFunction/extractFunction14.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod14.ts rename to tests/baselines/reference/extractFunction/extractFunction14.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod15.ts b/tests/baselines/reference/extractFunction/extractFunction15.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod15.ts rename to tests/baselines/reference/extractFunction/extractFunction15.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod16.ts b/tests/baselines/reference/extractFunction/extractFunction16.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod16.ts rename to tests/baselines/reference/extractFunction/extractFunction16.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod17.ts b/tests/baselines/reference/extractFunction/extractFunction17.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod17.ts rename to tests/baselines/reference/extractFunction/extractFunction17.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod18.ts b/tests/baselines/reference/extractFunction/extractFunction18.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod18.ts rename to tests/baselines/reference/extractFunction/extractFunction18.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod19.ts b/tests/baselines/reference/extractFunction/extractFunction19.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod19.ts rename to tests/baselines/reference/extractFunction/extractFunction19.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod2.ts b/tests/baselines/reference/extractFunction/extractFunction2.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod2.ts rename to tests/baselines/reference/extractFunction/extractFunction2.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod20.ts b/tests/baselines/reference/extractFunction/extractFunction20.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod20.ts rename to tests/baselines/reference/extractFunction/extractFunction20.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod21.ts b/tests/baselines/reference/extractFunction/extractFunction21.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod21.ts rename to tests/baselines/reference/extractFunction/extractFunction21.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod22.ts b/tests/baselines/reference/extractFunction/extractFunction22.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod22.ts rename to tests/baselines/reference/extractFunction/extractFunction22.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod23.ts b/tests/baselines/reference/extractFunction/extractFunction23.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod23.ts rename to tests/baselines/reference/extractFunction/extractFunction23.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod24.ts b/tests/baselines/reference/extractFunction/extractFunction24.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod24.ts rename to tests/baselines/reference/extractFunction/extractFunction24.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod25.ts b/tests/baselines/reference/extractFunction/extractFunction25.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod25.ts rename to tests/baselines/reference/extractFunction/extractFunction25.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod26.ts b/tests/baselines/reference/extractFunction/extractFunction26.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod26.ts rename to tests/baselines/reference/extractFunction/extractFunction26.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod27.ts b/tests/baselines/reference/extractFunction/extractFunction27.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod27.ts rename to tests/baselines/reference/extractFunction/extractFunction27.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod28.ts b/tests/baselines/reference/extractFunction/extractFunction28.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod28.ts rename to tests/baselines/reference/extractFunction/extractFunction28.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod29.ts b/tests/baselines/reference/extractFunction/extractFunction29.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod29.ts rename to tests/baselines/reference/extractFunction/extractFunction29.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod3.ts b/tests/baselines/reference/extractFunction/extractFunction3.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod3.ts rename to tests/baselines/reference/extractFunction/extractFunction3.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod30.ts b/tests/baselines/reference/extractFunction/extractFunction30.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod30.ts rename to tests/baselines/reference/extractFunction/extractFunction30.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod31.ts b/tests/baselines/reference/extractFunction/extractFunction31.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod31.ts rename to tests/baselines/reference/extractFunction/extractFunction31.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod32.ts b/tests/baselines/reference/extractFunction/extractFunction32.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod32.ts rename to tests/baselines/reference/extractFunction/extractFunction32.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod33.ts b/tests/baselines/reference/extractFunction/extractFunction33.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod33.ts rename to tests/baselines/reference/extractFunction/extractFunction33.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod4.ts b/tests/baselines/reference/extractFunction/extractFunction4.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod4.ts rename to tests/baselines/reference/extractFunction/extractFunction4.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod5.ts b/tests/baselines/reference/extractFunction/extractFunction5.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod5.ts rename to tests/baselines/reference/extractFunction/extractFunction5.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod6.ts b/tests/baselines/reference/extractFunction/extractFunction6.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod6.ts rename to tests/baselines/reference/extractFunction/extractFunction6.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod7.ts b/tests/baselines/reference/extractFunction/extractFunction7.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod7.ts rename to tests/baselines/reference/extractFunction/extractFunction7.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod8.ts b/tests/baselines/reference/extractFunction/extractFunction8.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod8.ts rename to tests/baselines/reference/extractFunction/extractFunction8.ts diff --git a/tests/baselines/reference/extractMethod/extractMethod9.ts b/tests/baselines/reference/extractFunction/extractFunction9.ts similarity index 100% rename from tests/baselines/reference/extractMethod/extractMethod9.ts rename to tests/baselines/reference/extractFunction/extractFunction9.ts