Skip to content

Commit 1cd0b30

Browse files
Added tests for getOccurrences on super.
1 parent 1121e11 commit 1cd0b30

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////class SuperType {
4+
//// superMethod() {
5+
//// }
6+
////
7+
//// static superStaticMethod() {
8+
//// return 10;
9+
//// }
10+
////}
11+
////
12+
////class SubType extends SuperType {
13+
//// public prop1 = [|s/**/uper|].superMethod;
14+
//// private prop2 = [|super|].superMethod;
15+
////
16+
//// constructor() {
17+
//// [|super|]();
18+
//// }
19+
////
20+
//// public method1() {
21+
//// return [|super|].superMethod();
22+
//// }
23+
////
24+
//// private method2() {
25+
//// return [|super|].superMethod();
26+
//// }
27+
////
28+
//// public method3() {
29+
//// var x = () => [|super|].superMethod();
30+
////
31+
//// // Bad but still gets highlighted
32+
//// function f() {
33+
//// [|super|].superMethod();
34+
//// }
35+
//// }
36+
////
37+
//// // Bad but still gets highlighted.
38+
//// public static statProp1 = super.superStaticMethod;
39+
////
40+
//// public static staticMethod1() {
41+
//// return super.superStaticMethod();
42+
//// }
43+
////
44+
//// private static staticMethod2() {
45+
//// return super.superStaticMethod();
46+
//// }
47+
////
48+
//// // Are not actually 'super' keywords.
49+
//// super = 10;
50+
//// static super = 20;
51+
////}
52+
53+
test.ranges().forEach(r => {
54+
goTo.position(r.start);
55+
56+
test.ranges().forEach(range => {
57+
verify.occurrencesAtPositionContains(range, false);
58+
});
59+
});
60+
61+
goTo.marker();
62+
test.ranges().forEach(range => {
63+
verify.occurrencesAtPositionContains(range, false);
64+
});
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////class SuperType {
4+
//// superMethod() {
5+
//// }
6+
////
7+
//// static superStaticMethod() {
8+
//// return 10;
9+
//// }
10+
////}
11+
////
12+
////class SubType extends SuperType {
13+
//// public prop1 = super.superMethod;
14+
//// private prop2 = super.superMethod;
15+
////
16+
//// constructor() {
17+
//// super();
18+
//// }
19+
////
20+
//// public method1() {
21+
//// return super.superMethod();
22+
//// }
23+
////
24+
//// private method2() {
25+
//// return super.superMethod();
26+
//// }
27+
////
28+
//// public method3() {
29+
//// var x = () => super.superMethod();
30+
////
31+
//// // Bad but still gets highlighted
32+
//// function f() {
33+
//// super.superMethod();
34+
//// }
35+
//// }
36+
////
37+
//// // Bad but still gets highlighted.
38+
//// public static statProp1 = [|super|].superStaticMethod;
39+
////
40+
//// public static staticMethod1() {
41+
//// return [|super|].superStaticMethod();
42+
//// }
43+
////
44+
//// private static staticMethod2() {
45+
//// return [|supe/**/r|].superStaticMethod();
46+
//// }
47+
////
48+
//// // Are not actually 'super' keywords.
49+
//// super = 10;
50+
//// static super = 20;
51+
////}
52+
53+
test.ranges().forEach(r => {
54+
goTo.position(r.start);
55+
56+
test.ranges().forEach(range => {
57+
verify.occurrencesAtPositionContains(range, false);
58+
});
59+
});
60+
61+
goTo.marker();
62+
test.ranges().forEach(range => {
63+
verify.occurrencesAtPositionContains(range, false);
64+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////function f(x = [|super|]) {
4+
//// [|super|];
5+
////}
6+
////
7+
////module M {
8+
//// [|super|];
9+
//// function f(x = [|super|]) {
10+
//// [|super|];
11+
//// }
12+
////
13+
//// class A {
14+
//// }
15+
////
16+
//// class B extends A {
17+
//// constructor() {
18+
//// super();
19+
//// }
20+
//// }
21+
////}
22+
23+
test.ranges().forEach(r => {
24+
goTo.position(r.start);
25+
26+
verify.occurrencesAtPositionCount(0);
27+
});

0 commit comments

Comments
 (0)