Add simple baseline tests for insertion positions
This commit is contained in:
parent
e77425f984
commit
62899d10cd
7 changed files with 267 additions and 2 deletions
|
@ -655,6 +655,60 @@ function test(x: number) {
|
|||
finally {
|
||||
[#|return 1;|]
|
||||
}
|
||||
}`);
|
||||
// Extraction position - namespace
|
||||
testExtractMethod("extractMethod23",
|
||||
`namespace NS {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
function M3() { }
|
||||
}`);
|
||||
// Extraction position - function
|
||||
testExtractMethod("extractMethod24",
|
||||
`function Outer() {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
function M3() { }
|
||||
}`);
|
||||
// Extraction position - file
|
||||
testExtractMethod("extractMethod25",
|
||||
`function M1() { }
|
||||
function M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
function M3() { }`);
|
||||
// Extraction position - class without ctor
|
||||
testExtractMethod("extractMethod26",
|
||||
`class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
M3() { }
|
||||
}`);
|
||||
// Extraction position - class with ctor in middle
|
||||
testExtractMethod("extractMethod27",
|
||||
`class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
constructor() { }
|
||||
M3() { }
|
||||
}`);
|
||||
// Extraction position - class with ctor at end
|
||||
testExtractMethod("extractMethod28",
|
||||
`class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
[#|return 1;|]
|
||||
}
|
||||
M3() { }
|
||||
constructor() { }
|
||||
}`);
|
||||
});
|
||||
|
||||
|
|
43
tests/baselines/reference/extractMethod/extractMethod23.ts
Normal file
43
tests/baselines/reference/extractMethod/extractMethod23.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
// ==ORIGINAL==
|
||||
namespace NS {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return 1;
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::function 'M2'==
|
||||
namespace NS {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::namespace 'NS'==
|
||||
namespace NS {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
namespace NS {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
43
tests/baselines/reference/extractMethod/extractMethod24.ts
Normal file
43
tests/baselines/reference/extractMethod/extractMethod24.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
// ==ORIGINAL==
|
||||
function Outer() {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return 1;
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::function 'M2'==
|
||||
function Outer() {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::function 'Outer'==
|
||||
function Outer() {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
function M3() { }
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
function Outer() {
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
}
|
||||
function M3() { }
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
26
tests/baselines/reference/extractMethod/extractMethod25.ts
Normal file
26
tests/baselines/reference/extractMethod/extractMethod25.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
// ==ORIGINAL==
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return 1;
|
||||
}
|
||||
function M3() { }
|
||||
// ==SCOPE::function 'M2'==
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
function M3() { }
|
||||
// ==SCOPE::global scope==
|
||||
function M1() { }
|
||||
function M2() {
|
||||
return newFunction();
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
function M3() { }
|
31
tests/baselines/reference/extractMethod/extractMethod26.ts
Normal file
31
tests/baselines/reference/extractMethod/extractMethod26.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
// ==ORIGINAL==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return 1;
|
||||
}
|
||||
M3() { }
|
||||
}
|
||||
// ==SCOPE::class 'C'==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return this.newFunction();
|
||||
}
|
||||
private newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
M3() { }
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return newFunction();
|
||||
}
|
||||
M3() { }
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
34
tests/baselines/reference/extractMethod/extractMethod27.ts
Normal file
34
tests/baselines/reference/extractMethod/extractMethod27.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
// ==ORIGINAL==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return 1;
|
||||
}
|
||||
constructor() { }
|
||||
M3() { }
|
||||
}
|
||||
// ==SCOPE::class 'C'==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return this.newFunction();
|
||||
}
|
||||
constructor() { }
|
||||
private newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
M3() { }
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return newFunction();
|
||||
}
|
||||
constructor() { }
|
||||
M3() { }
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
34
tests/baselines/reference/extractMethod/extractMethod28.ts
Normal file
34
tests/baselines/reference/extractMethod/extractMethod28.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
// ==ORIGINAL==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return 1;
|
||||
}
|
||||
M3() { }
|
||||
constructor() { }
|
||||
}
|
||||
// ==SCOPE::class 'C'==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return this.newFunction();
|
||||
}
|
||||
private newFunction() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
M3() { }
|
||||
constructor() { }
|
||||
}
|
||||
// ==SCOPE::global scope==
|
||||
class C {
|
||||
M1() { }
|
||||
M2() {
|
||||
return newFunction();
|
||||
}
|
||||
M3() { }
|
||||
constructor() { }
|
||||
}
|
||||
function newFunction() {
|
||||
return 1;
|
||||
}
|
Loading…
Reference in a new issue