| 1 |
This test exercises the "go_rename_symbol" MCP tool. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-mcp |
| 5 |
-ignore_extra_diags |
| 6 |
|
| 7 |
-- go.mod -- |
| 8 |
module example.com |
| 9 |
|
| 10 |
//@mcptool("go_rename_symbol", `{"file":"$WORKDIR/a/a.go","symbol":"Foo", "new_name": "Bar"}`, output=aFoo) |
| 11 |
//@mcptool("go_rename_symbol", `{"file":"$WORKDIR/a/a.go","symbol":"NonExistent", "new_name": "Bar"}`, output=aErr) |
| 12 |
|
| 13 |
-- a/a.go -- |
| 14 |
package a |
| 15 |
|
| 16 |
func Foo() {} |
| 17 |
|
| 18 |
func callFoo() { |
| 19 |
Foo() |
| 20 |
} |
| 21 |
|
| 22 |
-- @aFoo -- |
| 23 |
The following changes are necessary to rename the symbol: |
| 24 |
--- $WORKDIR/a/a.go |
| 25 |
+++ $WORKDIR/a/a.go |
| 26 |
@@ -1,8 +1,8 @@ |
| 27 |
package a |
| 28 |
|
| 29 |
-func Foo() {} |
| 30 |
+func Bar() {} |
| 31 |
|
| 32 |
func callFoo() { |
| 33 |
- Foo() |
| 34 |
+ Bar() |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
-- @aErr -- |
| 40 |
failed to resolve name "NonExistent" |