From 67eb6fc85920b8443bc8138eccd39224462930fc Mon Sep 17 00:00:00 2001 From: Markus Johnsson Date: Wed, 28 Feb 2018 12:07:41 +0100 Subject: [PATCH] Added more tests for #22180 --- .../codeFixUndeclaredMethodFunctionArgs.ts | 31 +++++++++++++++++++ ...odeFixUndeclaredMethodObjectLiteralArgs.ts | 17 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts create mode 100644 tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts diff --git a/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts b/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts new file mode 100644 index 00000000000..1c06cfc3afd --- /dev/null +++ b/tests/cases/fourslash/codeFixUndeclaredMethodFunctionArgs.ts @@ -0,0 +1,31 @@ +/// + +//// class A {[| +//// |]constructor() { +//// this.foo1(() => 1, () => "2", () => false); +//// this.foo2((a: number) => a, (b: string) => b, (c: boolean) => c); +//// } +//// } + +verify.codeFix({ + description: "Declare method 'foo1'", + index: 0, + newRangeContent: ` + foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any { + throw new Error("Method not implemented."); + } + `, +}); + +verify.codeFix({ + description: "Declare method 'foo2'", + index: 0, + newRangeContent: ` + foo2(arg0: (a: number) => number, arg1: (b: string) => string, arg2: (c: boolean) => boolean): any { + throw new Error("Method not implemented."); + } + foo1(arg0: () => number, arg1: () => string, arg2: () => boolean): any { + throw new Error("Method not implemented."); + } + ` +}); diff --git a/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts b/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts new file mode 100644 index 00000000000..bd434cf9d9d --- /dev/null +++ b/tests/cases/fourslash/codeFixUndeclaredMethodObjectLiteralArgs.ts @@ -0,0 +1,17 @@ +/// + +//// class A {[| +//// |]constructor() { +//// this.foo1(null, {}, { a: 1, b: "2"}); +//// } +//// } + +verify.codeFix({ + description: "Declare method 'foo1'", + index: 0, + newRangeContent: ` + foo1(arg0: null, arg1: {}, arg2: { a: number; b: string; }): any { + throw new Error("Method not implemented."); + } + ` +});