Skip to content

Commit 35c0499

Browse files
committed
More tests
1 parent 004488c commit 35c0499

25 files changed

+97
-87
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/// <reference path="fourslash.ts" />
22

33
// @Filename: a.ts
4-
////function [|{| "isWriteAccess": true, "isDefinition": true |}decorator|](target) {
4+
////[|function [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}decorator|](target) {
55
//// return target;
6-
////}
6+
////}|]
77
////[|decorator|]();
88

99
// @Filename: b.ts
@@ -13,4 +13,4 @@
1313
//// method() {}
1414
////}
1515

16-
verify.singleReferenceGroup("function decorator(target: any): any");
16+
verify.singleReferenceGroup("function decorator(target: any): any", test.rangesByText().get("decorator"));

tests/cases/fourslash/findAllRefsOnDefinition.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
////
88
//// }
99
////
10-
//// public [|{| "isWriteAccess": true, "isDefinition": true |}start|](){
10+
//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|](){
1111
//// return this;
12-
//// }
12+
//// }|]
1313
////
1414
//// public stop(){
1515
//// return this;
@@ -23,4 +23,4 @@
2323
////second.[|start|]();
2424
////second.stop();
2525

26-
verify.singleReferenceGroup("(method) Test.start(): this");
26+
verify.singleReferenceGroup("(method) Test.start(): this", test.rangesByText().get("start"));

tests/cases/fourslash/findAllRefsOnDefinition2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@Filename: findAllRefsOnDefinition2-import.ts
44
////export module Test{
55
////
6-
//// export interface [|{| "isWriteAccess": true, "isDefinition": true |}start|] { }
6+
//// [|export interface [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}start|] { }|]
77
////
88
//// export interface stop { }
99
////}
@@ -14,4 +14,4 @@
1414
////var start: Second.Test.[|start|];
1515
////var stop: Second.Test.stop;
1616

17-
verify.singleReferenceGroup("interface Test.start");
17+
verify.singleReferenceGroup("interface Test.start", test.rangesByText().get("start"));

tests/cases/fourslash/findAllRefsOnImportAliases.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/// <reference path="fourslash.ts" />
22

33
//@Filename: a.ts
4-
////export class [|{| "isWriteAccess": true, "isDefinition": true |}Class|] {
5-
////}
4+
////[|export class [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}Class|] {
5+
////}|]
66

77
//@Filename: b.ts
8-
////import { [|{| "isWriteAccess": true, "isDefinition": true |}Class|] } from "./a";
8+
////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}Class|] } from "./a";|]
99
////
1010
////var c = new [|Class|]();
1111

1212
//@Filename: c.ts
13-
////export { [|{| "isWriteAccess": true, "isDefinition": true |}Class|] } from "./a";
13+
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 5 |}Class|] } from "./a";|]
1414

1515
const ranges = test.ranges();
16-
const [r0, r1, r2, r3] = ranges;
16+
const [r0Def, r0, r1Def, r1, r2, r3Def, r3] = ranges;
1717
const classes = { definition: "class Class", ranges: [r0] };
1818
const imports = { definition: "(alias) class Class\nimport Class", ranges: [r1, r2] };
1919
const reExports = { definition: "(alias) class Class\nexport Class", ranges: [r3] };
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/// <reference path="fourslash.ts" />
22

33
////class ABCD {
4-
//// constructor(private x: number, public y: number, private [|{| "isWriteAccess": true, "isDefinition": true |}z|]: number) {
4+
//// constructor(private x: number, public y: number, [|private [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}z|]: number|]) {
55
//// }
66
////
77
//// func() {
88
//// return this.[|z|];
99
//// }
1010
////}
1111

12-
verify.singleReferenceGroup("(property) ABCD.z: number");
12+
verify.singleReferenceGroup("(property) ABCD.z: number", test.rangesByText().get("z"));

tests/cases/fourslash/findAllRefsParameterPropertyDeclaration1.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/// <reference path='fourslash.ts'/>
22

33
//// class Foo {
4-
//// constructor(private [|{| "isWriteAccess": true, "isDefinition": true |}privateParam|]: number) {
4+
//// constructor([|private [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}privateParam|]: number|]) {
55
//// let localPrivate = [|privateParam|];
66
//// this.[|{| "isWriteAccess": true |}privateParam|] += 10;
77
//// }
88
//// }
99

10-
const ranges = test.ranges();
10+
const [rDef, ...ranges] = test.ranges();
1111
const [r0, r1, r2] = ranges;
1212
verify.referenceGroups(ranges, [
1313
{ definition: "(property) Foo.privateParam: number", ranges: [r0, r2] },

tests/cases/fourslash/findAllRefsParameterPropertyDeclaration2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/// <reference path='fourslash.ts'/>
22

33
//// class Foo {
4-
//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}publicParam|]: number) {
4+
//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}publicParam|]: number|]) {
55
//// let localPublic = [|publicParam|];
66
//// this.[|{| "isWriteAccess": true |}publicParam|] += 10;
77
//// }
88
//// }
99

10-
const ranges = test.ranges();
10+
const [rDef, ...ranges] = test.ranges();
1111
const [r0, r1, r2] = ranges;
1212
verify.referenceGroups(ranges, [
1313
{ definition: "(property) Foo.publicParam: number", ranges: [r0, r2] },

tests/cases/fourslash/findAllRefsParameterPropertyDeclaration3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/// <reference path='fourslash.ts'/>
22

33
//// class Foo {
4-
//// constructor(protected [|{| "isWriteAccess": true, "isDefinition": true |}protectedParam|]: number) {
4+
//// constructor([|protected [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}protectedParam|]: number|]) {
55
//// let localProtected = [|protectedParam|];
66
//// this.[|{| "isWriteAccess": true |}protectedParam|] += 10;
77
//// }
88
//// }
99

10-
const ranges = test.ranges();
10+
const [rDef, ...ranges] = test.ranges();
1111
const [r0, r1, r2] = ranges;
1212
verify.referenceGroups(ranges, [
1313
{ definition: "(property) Foo.protectedParam: number", ranges: [r0, r2] },

tests/cases/fourslash/findAllRefsParameterPropertyDeclaration_inheritance.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/// <reference path='fourslash.ts'/>
22

33
////class C {
4-
//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}x|]: string) {
4+
//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}x|]: string|]) {
55
//// [|x|];
66
//// }
77
////}
88
////class D extends C {
9-
//// constructor(public [|{| "isWriteAccess": true, "isDefinition": true |}x|]: string) {
9+
//// constructor([|public [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 3 |}x|]: string|]) {
1010
//// super([|x|]);
1111
//// }
1212
////}
1313

14-
const [r0, r1, r2, r3] = test.ranges();
14+
const [r0Def, r0, r1, r2Def, r2, r3] = test.ranges();
1515
verify.referenceGroups(r0, [
1616
{ definition: "(property) C.x: string", ranges: [r0] },
1717
{ definition: "(parameter) x: string", ranges: [r1] },

tests/cases/fourslash/findAllRefsPrefixSuffixPreference.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
// @Filename: /file1.ts
44
////declare function log(s: string | number): void;
5-
////const [|{| "isWriteAccess": true, "isDefinition": true |}q|] = 1;
6-
////export { [|{| "isWriteAccess": true, "isDefinition": true |}q|] };
5+
////[|const [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}q|] = 1;|]
6+
////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}q|] };|]
77
////const x = {
8-
//// [|{| "isWriteAccess": true, "isDefinition": true |}z|]: 'value'
8+
//// [|[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 4 |}z|]: 'value'|]
99
////}
10-
////const { [|{| "isWriteAccess": true, "isDefinition": true |}z|] } = x;
10+
////[|const { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 6 |}z|] } = x;|]
1111
////log([|z|]);
1212

1313
// @Filename: /file2.ts
1414
////declare function log(s: string | number): void;
15-
////import { [|{| "isWriteAccess": true, "isDefinition": true |}q|] } from "./file1";
15+
////[|import { [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 9 |}q|] } from "./file1";|]
1616
////log([|q|] + 1);
1717

1818
verify.noErrors();
1919

20-
const [q0, q1, z0, z1, z2, q2, q3] = test.ranges();
20+
const [q0Def, q0, q1Def, q1, z0Def, z0, z1Def, z1, z2, q2Def, q2, q3] = test.ranges();
2121
const qFile1Ranges = [q0, q1];
2222
const qFile2Ranges = [q2, q3];
2323
const qFile1ReferenceGroup: FourSlashInterface.ReferenceGroup = {

0 commit comments

Comments
 (0)