Skip to content

Commit 4191b8c

Browse files
committed
internal/lsp/testadata/rename: add a test case for renames across packages
Renames across packages works as of https://golang.org/cl/206883. Add a test for it. Fixes golang/go#32877 Change-Id: I234fafe95a1060c0ca8d03462bf7b2c241d59e4a Reviewed-on: https://go-review.googlesource.com/c/tools/+/207264 Run-TryBot: Michael Matloob <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 634482e commit 4191b8c

File tree

4 files changed

+56
-1
lines changed

4 files changed

+56
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package crosspkg
2+
3+
func Foo() { //@rename("Foo", "Dolphin")
4+
5+
}
6+
7+
var Bar int //@rename("Bar", "Tomato")
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-- Dolphin-rename --
2+
crosspkg.go:
3+
package crosspkg
4+
5+
func Dolphin() { //@rename("Foo", "Dolphin")
6+
7+
}
8+
9+
var Bar int //@rename("Bar", "Tomato")
10+
11+
other.go:
12+
package other
13+
14+
import "golang.org/x/tools/internal/lsp/rename/crosspkg"
15+
16+
func Other() {
17+
crosspkg.Bar
18+
crosspkg.Dolphin()
19+
}
20+
21+
-- Tomato-rename --
22+
crosspkg.go:
23+
package crosspkg
24+
25+
func Foo() { //@rename("Foo", "Dolphin")
26+
27+
}
28+
29+
var Tomato int //@rename("Bar", "Tomato")
30+
31+
other.go:
32+
package other
33+
34+
import "golang.org/x/tools/internal/lsp/rename/crosspkg"
35+
36+
func Other() {
37+
crosspkg.Tomato
38+
crosspkg.Foo()
39+
}
40+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package other
2+
3+
import "golang.org/x/tools/internal/lsp/rename/crosspkg"
4+
5+
func Other() {
6+
crosspkg.Bar
7+
crosspkg.Foo()
8+
}

internal/lsp/testdata/summary.txt.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ DefinitionsCount = 38
1515
TypeDefinitionsCount = 2
1616
HighlightsCount = 2
1717
ReferencesCount = 7
18-
RenamesCount = 20
18+
RenamesCount = 22
1919
PrepareRenamesCount = 8
2020
SymbolsCount = 1
2121
SignaturesCount = 21

0 commit comments

Comments
 (0)