Added tests for getOccurrences on super.
This commit is contained in:
parent
1121e11c45
commit
1cd0b306ed
3 changed files with 155 additions and 0 deletions
64
tests/cases/fourslash/getOccurrencesSuper.ts
Normal file
64
tests/cases/fourslash/getOccurrencesSuper.ts
Normal file
|
@ -0,0 +1,64 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class SuperType {
|
||||
//// superMethod() {
|
||||
//// }
|
||||
////
|
||||
//// static superStaticMethod() {
|
||||
//// return 10;
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////class SubType extends SuperType {
|
||||
//// public prop1 = [|s/**/uper|].superMethod;
|
||||
//// private prop2 = [|super|].superMethod;
|
||||
////
|
||||
//// constructor() {
|
||||
//// [|super|]();
|
||||
//// }
|
||||
////
|
||||
//// public method1() {
|
||||
//// return [|super|].superMethod();
|
||||
//// }
|
||||
////
|
||||
//// private method2() {
|
||||
//// return [|super|].superMethod();
|
||||
//// }
|
||||
////
|
||||
//// public method3() {
|
||||
//// var x = () => [|super|].superMethod();
|
||||
////
|
||||
//// // Bad but still gets highlighted
|
||||
//// function f() {
|
||||
//// [|super|].superMethod();
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// // Bad but still gets highlighted.
|
||||
//// public static statProp1 = super.superStaticMethod;
|
||||
////
|
||||
//// public static staticMethod1() {
|
||||
//// return super.superStaticMethod();
|
||||
//// }
|
||||
////
|
||||
//// private static staticMethod2() {
|
||||
//// return super.superStaticMethod();
|
||||
//// }
|
||||
////
|
||||
//// // Are not actually 'super' keywords.
|
||||
//// super = 10;
|
||||
//// static super = 20;
|
||||
////}
|
||||
|
||||
test.ranges().forEach(r => {
|
||||
goTo.position(r.start);
|
||||
|
||||
test.ranges().forEach(range => {
|
||||
verify.occurrencesAtPositionContains(range, false);
|
||||
});
|
||||
});
|
||||
|
||||
goTo.marker();
|
||||
test.ranges().forEach(range => {
|
||||
verify.occurrencesAtPositionContains(range, false);
|
||||
});
|
64
tests/cases/fourslash/getOccurrencesSuper2.ts
Normal file
64
tests/cases/fourslash/getOccurrencesSuper2.ts
Normal file
|
@ -0,0 +1,64 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////class SuperType {
|
||||
//// superMethod() {
|
||||
//// }
|
||||
////
|
||||
//// static superStaticMethod() {
|
||||
//// return 10;
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////class SubType extends SuperType {
|
||||
//// public prop1 = super.superMethod;
|
||||
//// private prop2 = super.superMethod;
|
||||
////
|
||||
//// constructor() {
|
||||
//// super();
|
||||
//// }
|
||||
////
|
||||
//// public method1() {
|
||||
//// return super.superMethod();
|
||||
//// }
|
||||
////
|
||||
//// private method2() {
|
||||
//// return super.superMethod();
|
||||
//// }
|
||||
////
|
||||
//// public method3() {
|
||||
//// var x = () => super.superMethod();
|
||||
////
|
||||
//// // Bad but still gets highlighted
|
||||
//// function f() {
|
||||
//// super.superMethod();
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// // Bad but still gets highlighted.
|
||||
//// public static statProp1 = [|super|].superStaticMethod;
|
||||
////
|
||||
//// public static staticMethod1() {
|
||||
//// return [|super|].superStaticMethod();
|
||||
//// }
|
||||
////
|
||||
//// private static staticMethod2() {
|
||||
//// return [|supe/**/r|].superStaticMethod();
|
||||
//// }
|
||||
////
|
||||
//// // Are not actually 'super' keywords.
|
||||
//// super = 10;
|
||||
//// static super = 20;
|
||||
////}
|
||||
|
||||
test.ranges().forEach(r => {
|
||||
goTo.position(r.start);
|
||||
|
||||
test.ranges().forEach(range => {
|
||||
verify.occurrencesAtPositionContains(range, false);
|
||||
});
|
||||
});
|
||||
|
||||
goTo.marker();
|
||||
test.ranges().forEach(range => {
|
||||
verify.occurrencesAtPositionContains(range, false);
|
||||
});
|
27
tests/cases/fourslash/getOccurrencesSuperNegatives.ts
Normal file
27
tests/cases/fourslash/getOccurrencesSuperNegatives.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////function f(x = [|super|]) {
|
||||
//// [|super|];
|
||||
////}
|
||||
////
|
||||
////module M {
|
||||
//// [|super|];
|
||||
//// function f(x = [|super|]) {
|
||||
//// [|super|];
|
||||
//// }
|
||||
////
|
||||
//// class A {
|
||||
//// }
|
||||
////
|
||||
//// class B extends A {
|
||||
//// constructor() {
|
||||
//// super();
|
||||
//// }
|
||||
//// }
|
||||
////}
|
||||
|
||||
test.ranges().forEach(r => {
|
||||
goTo.position(r.start);
|
||||
|
||||
verify.occurrencesAtPositionCount(0);
|
||||
});
|
Loading…
Reference in a new issue