From 834245cd8f0db5560ee511c7483c852236151c1c Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Fri, 28 Oct 2016 11:57:30 -0700 Subject: [PATCH] Add Failing Tests --- .../codeFixClassExtendsAbstractFunction.ts | 13 ++++ ...eFixClassExtendsAbstractProtectedNumber.ts | 11 ++++ ...codeFixClassExtendsAbstractPublicNumber.ts | 11 ++++ .../codeFixInterfaceInExtendsClause.ts | 12 ++++ ...mentedInterfaceMissingMultipleFunctions.ts | 22 +++++++ ...MissingMultipleFunctionsDeepInheritance.ts | 62 +++++++++++++++++++ 6 files changed, 131 insertions(+) create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts create mode 100644 tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts create mode 100644 tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts create mode 100644 tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts new file mode 100644 index 00000000000..6bed7a3fe0f --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractFunction.ts @@ -0,0 +1,13 @@ +/// + +//// abstract class A { +//// abstract f(); +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`f(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts new file mode 100644 index 00000000000..7f525632fc5 --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractProtectedNumber.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// protected abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`protected x: number; +`); diff --git a/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts new file mode 100644 index 00000000000..82cafbd86ad --- /dev/null +++ b/tests/cases/fourslash/codeFixClassExtendsAbstractPublicNumber.ts @@ -0,0 +1,11 @@ +/// + +//// abstract class A { +//// public abstract x: number; +//// } +//// +//// class C extends A {[| +//// |]} + +verify.codeFixAtPosition(`public x: number; +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts new file mode 100644 index 00000000000..c08cdc30952 --- /dev/null +++ b/tests/cases/fourslash/codeFixInterfaceInExtendsClause.ts @@ -0,0 +1,12 @@ +/// + +//// interface I { +//// f1(); +//// } +//// +//// class /*0*/C/*1*/ /*2*/extend/*3*/s/*4*/ /*5*/I/*6*/ {/*7*/} + +for (let i = 0; i < 8; ++i) { + goTo.marker("" + i); + verify.codeFixAtPosition(""); +} \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts new file mode 100644 index 00000000000..02415491191 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctions.ts @@ -0,0 +1,22 @@ +/// + +//// class C1 { +//// f1(); +//// } +//// +//// class C2 { +//// f2(); +//// } +//// +//// interface I1 extends C1, C2 {} +//// +//// class C3 implements I1 {[| +//// |]} + +verify.codeFixAtPosition(`f1(){ + throw new Error('Method not Implemented'); +} +f2(){ + throw new Error('Method not Implemented'); +} +`); \ No newline at end of file diff --git a/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts new file mode 100644 index 00000000000..729df3a91c8 --- /dev/null +++ b/tests/cases/fourslash/codeFixUnimplementedInterfaceMissingMultipleFunctionsDeepInheritance.ts @@ -0,0 +1,62 @@ +/// + + +//// // Referenced throughout the inheritance chain. +//// interface I0 { a: number } +//// +//// class C1 implements I0 { a: number } +//// interface I1 { b: number } +//// interface I2 extends C1, I1 {} +//// +//// class C2 { c: number } +//// interface I3 {d: number} +//// class C3 extends C2 implements I0, I2, I3 { +//// a: number; +//// b: number; +//// d: number; +//// } +//// +//// interface I4 { e: number } +//// interface I5 { f: number } +//// class C4 extends C3 implements I0, I4, I5 { +//// e: number; +//// f: number; +//// } +//// +//// interface I6 extends C4 {} +//// class C5 implements I6 {[| +//// |]} + + +/** + * We want to check whether the search for member to replace actually searches through + * the various possible paths of the inheritance chain correctly, and that We + * don't issue duplicates for the same member. + * + * Our class DAG: + * + * C5 + * |-I6 + * |-C4 + * |-I4 + * |-I5 + * |------------------------ I0 + * |-C3 + * |-I2 + * |-I1 + * |-C1 + * |-------------------I0 + * |-I3 + * |-----------------------I0 + * |-C2 + */ + + +verify.codeFixAtPosition( +`a: number; +b: number; +c: number; +d: number; +e: number: +f: number; +`);