Skip to content

Commit 01bbc4d

Browse files
committed
More tests
1 parent 0fee3b0 commit 01bbc4d

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

tests/cases/fourslash/renameCrossJsTs01.ts

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

33
// @allowJs: true
44
// @Filename: a.js
5-
////exports.[|area|] = function (r) { return r * r; }
5+
////[|exports.[|{| "declarationRangeIndex": 0 |}area|] = function (r) { return r * r; }|]
66

77
// @Filename: b.ts
8-
////import { [|area|] } from './a';
8+
////[|import { [|{| "declarationRangeIndex": 2 |}area|] } from './a';|]
99
////var t = [|area|](10);
1010

11-
const [r0, r1, r2] = test.ranges();
11+
const [r0Def, r0, r1Def, r1, r2] = test.ranges();
1212
verify.renameLocations(r0, [r0, r1, r2]);
1313
verify.renameLocations([r1, r2], [{ range: r1, prefixText: "area as " }, r2]);
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
/// <reference path='fourslash.ts' />
22

33
// @Filename: B.ts
4-
////export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true |}B|] {
4+
////[|export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}B|] {
55
//// test() {
66
//// }
7-
////}
7+
////}|]
88

99
// @Filename: A.ts
10-
////import [|{| "isWriteAccess": true, "isDefinition": true |}B|] from "./B";
10+
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] from "./B";|]
1111
////let b = new [|B|]();
1212
////b.test();
1313

1414
goTo.marker("1");
1515
verify.occurrencesAtPositionCount(1);
1616

17-
const ranges = test.ranges();
18-
const [C, B0, B1] = ranges;
17+
const [CDef, C, B0Def, B0, B1] = test.ranges();;
1918

2019
const classes = { definition: "class B", ranges: [C] };
2120
const imports = { definition: "(alias) class B\nimport B", ranges: [B0, B1] };
2221
verify.referenceGroups(C, [classes, imports]);
2322
verify.referenceGroups([B0, B1], [imports, classes]);
2423

25-
verify.renameLocations(C, ranges);
24+
verify.renameLocations(C, [C, B0, B1]);
2625
verify.rangesAreRenameLocations([B0, B1]);

tests/cases/fourslash/renameDefaultImportDifferentName.ts

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

33
// @Filename: B.ts
4-
////export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true |}C|] {
4+
////[|export default class /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 0 |}C|] {
55
//// test() {
66
//// }
7-
////}
7+
////}|]
88

99
// @Filename: A.ts
10-
////import [|{| "isWriteAccess": true, "isDefinition": true |}B|] from "./B";
10+
////[|import [|{| "isWriteAccess": true, "isDefinition": true, "declarationRangeIndex": 2 |}B|] from "./B";|]
1111
////let b = new [|B|]();
1212
////b.test();
1313

1414
goTo.marker("1");
1515
verify.occurrencesAtPositionCount(1);
1616

17-
const ranges = test.ranges();
18-
const [C, B0, B1] = ranges;
17+
const [CDef, C, B0Def, B0, B1] = test.ranges();
1918
const bRanges = [B0, B1];
2019
const classes = { definition: "class C", ranges: [C] };
2120
const imports = { definition: "(alias) class B\nimport B", ranges: [B0, B1] };

tests/cases/fourslash/renameDefaultLibDontWork.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// "test" is a comment on the default library.
55

66
// @Filename: file1.ts
7-
//// var [|test|] = "foo";
7+
//// [|var [|{| "declarationRangeIndex": 0 |}test|] = "foo";|]
88
//// console.log([|test|]);
99

10-
const ranges = test.ranges();
10+
const [r0Def, ...ranges] = test.ranges();
1111
verify.renameLocations(ranges[0], { findInComments: true, ranges });

0 commit comments

Comments
 (0)