Skip to content

Commit 58e5e62

Browse files
h9jianggopherbot
authored andcommitted
gopls/internal/test/marker: organize mcp tool context test
To avoid confusion, different kind contest test have its own package, and the test is always triggered from testkind/main.go. For golang/go#73580 Change-Id: I6197d30ed4c8b4813f44efdbc45bb46162116006 Reviewed-on: https://go-review.googlesource.com/c/tools/+/678155 Auto-Submit: Hongxiang Jiang <hxjiang@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent ec7b2b3 commit 58e5e62

File tree

1 file changed

+66
-66
lines changed
  • gopls/internal/test/marker/testdata/mcptools

1 file changed

+66
-66
lines changed

gopls/internal/test/marker/testdata/mcptools/context.txt

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ This test exercises mcp tool context.
77
-- go.mod --
88
module example.com
99

10-
-- comment/doc.go --
10+
-- commenttest/main.go --
11+
package main
12+
13+
import(
14+
"example.com/commenttest/comment"
15+
)
16+
17+
func testComment() { //@loc(comment, "test")
18+
comment.Foo("", 0)
19+
function.Foo(0, "")
20+
}
21+
22+
//@mcptool("context", `{}`, comment, output=withComment)
23+
24+
-- commenttest/comment/doc.go --
1125
// Copyright 2025 The Go Authors. All rights reserved.
1226
// Use of this source code is governed by a BSD-style
1327
// license that can be found in the LICENSE file.
@@ -17,17 +31,17 @@ Package doc for package comment.
1731
*/
1832
package comment
1933

20-
-- comment/foo.go --
21-
// File doc for foo.go part 1.
34+
-- commenttest/comment/comment.go --
35+
// File doc for comment.go part 1.
2236
package comment
2337

24-
// File doc for foo.go part 2.
38+
// File doc for comment.go part 2.
2539
import (
2640
// comment for package renaming.
2741
myfmt "fmt"
2842
)
2943

30-
// File doc for foo.go part 3.
44+
// File doc for comment.go part 3.
3145

3246
// Func doc for comment.Foo
3347
func Foo(foo string, _ int) {
@@ -36,61 +50,60 @@ func Foo(foo string, _ int) {
3650

3751
// Random comment floating around.
3852

39-
-- comment.go --
40-
package main
41-
42-
import(
43-
"example.com/comment"
44-
)
45-
46-
func testComment() { //@loc(comment, "test")
47-
comment.Foo("", 0)
48-
function.Foo(0, "")
49-
}
50-
51-
//@mcptool("context", `{}`, comment, output=withComment)
52-
5353
-- @withComment --
5454
Code blocks are delimited by --->...<--- markers.
5555

56-
Current file "comment.go" contains this import declaration:
56+
Current file "main.go" contains this import declaration:
5757
--->
5858
import(
59-
"example.com/comment"
59+
"example.com/commenttest/comment"
6060
)
6161
<---
6262

6363
The imported packages declare the following symbols:
6464

65-
example.com/comment (package comment)
66-
doc.go:
67-
--->
68-
/*
69-
Package doc for package comment.
70-
*/
71-
package comment
72-
73-
<---
74-
75-
foo.go:
65+
example.com/commenttest/comment (package comment)
66+
comment.go:
7667
--->
77-
// File doc for foo.go part 1.
68+
// File doc for comment.go part 1.
7869
package comment
7970

80-
// File doc for foo.go part 2.
71+
// File doc for comment.go part 2.
8172
import (
8273
// comment for package renaming.
8374
myfmt "fmt"
8475
)
8576

86-
// File doc for foo.go part 3.
77+
// File doc for comment.go part 3.
8778

8879
// Func doc for comment.Foo
8980
func Foo(foo string, _ int)
9081

9182
<---
9283

93-
-- function/foo.go --
84+
doc.go:
85+
--->
86+
/*
87+
Package doc for package comment.
88+
*/
89+
package comment
90+
91+
<---
92+
93+
-- functiontest/main.go --
94+
package main
95+
96+
import(
97+
"example.com/functiontest/function"
98+
)
99+
100+
func testFunction() { //@loc(function, "test")
101+
function.Foo(0, "")
102+
}
103+
104+
//@mcptool("context", `{}`, function, output=withFunction)
105+
106+
-- functiontest/function/function.go --
94107
package function
95108

96109
func Foo(int, string) {}
@@ -109,33 +122,20 @@ func (*Exported) unexported(int) {}
109122

110123
func (*Exported) Exported(int) {}
111124

112-
-- function.go --
113-
package main
114-
115-
import(
116-
"example.com/function"
117-
)
118-
119-
func testFunction() { //@loc(function, "test")
120-
function.Foo(0, "")
121-
}
122-
123-
//@mcptool("context", `{}`, function, output=withFunction)
124-
125125
-- @withFunction --
126126
Code blocks are delimited by --->...<--- markers.
127127

128-
Current file "function.go" contains this import declaration:
128+
Current file "main.go" contains this import declaration:
129129
--->
130130
import(
131-
"example.com/function"
131+
"example.com/functiontest/function"
132132
)
133133
<---
134134

135135
The imported packages declare the following symbols:
136136

137-
example.com/function (package function)
138-
foo.go:
137+
example.com/functiontest/function (package function)
138+
function.go:
139139
--->
140140
package function
141141

@@ -147,18 +147,18 @@ func (*Exported) Exported(int)
147147

148148
<---
149149

150-
-- type.go --
150+
-- typetest/main.go --
151151
package main
152152

153153
import(
154-
"example.com/types"
154+
"example.com/typetest/types"
155155
)
156156

157157
var x types.Exported //@loc(types, "x")
158158

159159
//@mcptool("context", `{}`, types, output=withType)
160160

161-
-- types/types.go --
161+
-- typetest/types/types.go --
162162
package types
163163

164164
// Doc for exported.
@@ -192,16 +192,16 @@ type (
192192
-- @withType --
193193
Code blocks are delimited by --->...<--- markers.
194194

195-
Current file "type.go" contains this import declaration:
195+
Current file "main.go" contains this import declaration:
196196
--->
197197
import(
198-
"example.com/types"
198+
"example.com/typetest/types"
199199
)
200200
<---
201201

202202
The imported packages declare the following symbols:
203203

204-
example.com/types (package types)
204+
example.com/typetest/types (package types)
205205
types.go:
206206
--->
207207
package types
@@ -229,18 +229,18 @@ type (
229229

230230
<---
231231

232-
-- value.go --
232+
-- valuetest/main.go --
233233
package main
234234

235235
import(
236-
"example.com/values"
236+
"example.com/valuetest/values"
237237
)
238238

239239
var y values.ConstFoo //@loc(values, "y")
240240

241241
//@mcptool("context", `{}`, values, output=withValue)
242242

243-
-- values/consts.go --
243+
-- valuetest/values/consts.go --
244244
package values
245245

246246
const (
@@ -260,7 +260,7 @@ const ConstExported = "Exported" // comment for ConstExported
260260
// doc for constUnexported
261261
var constUnexported = "unexported" // comment for constUnexported
262262

263-
-- values/vars.go --
263+
-- valuetest/values/vars.go --
264264
package values
265265

266266
var (
@@ -283,16 +283,16 @@ var varUnexported = "unexported" // comment for varUnexported
283283
-- @withValue --
284284
Code blocks are delimited by --->...<--- markers.
285285

286-
Current file "value.go" contains this import declaration:
286+
Current file "main.go" contains this import declaration:
287287
--->
288288
import(
289-
"example.com/values"
289+
"example.com/valuetest/values"
290290
)
291291
<---
292292

293293
The imported packages declare the following symbols:
294294

295-
example.com/values (package values)
295+
example.com/valuetest/values (package values)
296296
consts.go:
297297
--->
298298
package values

0 commit comments

Comments
 (0)