mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-04 14:56:16 -05:00
Add more test coverage for unusedParameterInLambda
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
// @noUnusedLocals: true
|
||||
// @noUnusedParameters: true
|
||||
//// function f1() {
|
||||
//// [|return (x:number) => {}|]
|
||||
//// [|return /*~a*/(/*~b*/x/*~c*/:/*~d*/number/*~e*/)/*~f*/ => /*~g*/{/*~h*/}/*~i*/|]
|
||||
//// }
|
||||
|
||||
// In a perfect world, /*~f*/ and /*~h*/ would probably be retained.
|
||||
verify.codeFix({
|
||||
description: "Remove declaration for: 'x'",
|
||||
index: 0,
|
||||
newRangeContent: "return () => {}",
|
||||
newRangeContent: "return /*~a*/() => /*~g*/ { }/*~i*/",
|
||||
});
|
||||
|
||||
14
tests/cases/fourslash/unusedParameterInLambda2.ts
Normal file
14
tests/cases/fourslash/unusedParameterInLambda2.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
// @noUnusedParameters: true
|
||||
//// function f1() {
|
||||
//// [|return /*~a*/x/*~b*/ /*~c*/=>/*~d*/ {/*~e*/}/*~f*/|]
|
||||
//// }
|
||||
|
||||
// In a perfect world, /*~c*/ and /*~e*/ would probably be retained.
|
||||
verify.codeFix({
|
||||
description: "Remove declaration for: 'x'",
|
||||
index: 0,
|
||||
newRangeContent: "return /*~a*/() => /*~d*/ { }/*~f*/",
|
||||
});
|
||||
14
tests/cases/fourslash/unusedParameterInLambda3.ts
Normal file
14
tests/cases/fourslash/unusedParameterInLambda3.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
// @noUnusedParameters: true
|
||||
//// function f1() {
|
||||
//// [|return /*~a*/(/*~b*/x/*~c*/,/*~d*/y/*~e*/)/*~f*/ => /*~g*/x/*~h*/|]
|
||||
//// }
|
||||
|
||||
// In a perfect world, /*~c*/ would probably be retained, rather than /*~e*/.
|
||||
verify.codeFix({
|
||||
description: "Remove declaration for: 'y'",
|
||||
index: 0,
|
||||
newRangeContent: "return /*~a*/(/*~b*/x/*~e*/)/*~f*/ => /*~g*/x/*~h*/",
|
||||
});
|
||||
13
tests/cases/fourslash/unusedParameterInLambda4.ts
Normal file
13
tests/cases/fourslash/unusedParameterInLambda4.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @noUnusedLocals: true
|
||||
// @noUnusedParameters: true
|
||||
//// function f1() {
|
||||
//// [|return /*~a*/(/*~b*/x/*~c*/,/*~d*/y/*~e*/)/*~f*/ => /*~g*/y/*~h*/|]
|
||||
//// }
|
||||
|
||||
verify.codeFix({
|
||||
description: "Remove declaration for: 'x'",
|
||||
index: 0,
|
||||
newRangeContent: "return /*~a*/(/*~d*/y/*~e*/)/*~f*/ => /*~g*/y/*~h*/",
|
||||
});
|
||||
Reference in New Issue
Block a user