Skip to content

Commit a7e7dc4

Browse files
committed
go/ssa: rename test cases in TestGenericBodies
Previous test cases were an alphabetical series starting at p and wrapping around to l. These are now numbered from p00 to p23. Change-Id: I4ce4f4f9e591cdcff2e67e26103654bb04c5d932 Reviewed-on: https://go-review.googlesource.com/c/tools/+/493058 Reviewed-by: Alan Donovan <[email protected]> Run-TryBot: Tim King <[email protected]> TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]>
1 parent d668f58 commit a7e7dc4

File tree

1 file changed

+53
-44
lines changed

1 file changed

+53
-44
lines changed

go/ssa/builder_generic_test.go

+53-44
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestGenericBodies(t *testing.T) {
3636
}
3737
for _, contents := range []string{
3838
`
39-
package p
39+
package p00
4040
4141
func f(x int) {
4242
var i interface{}
@@ -46,22 +46,22 @@ func TestGenericBodies(t *testing.T) {
4646
}
4747
`,
4848
`
49-
package q
49+
package p01
5050
5151
func f[T any](x T) {
5252
print(x) //@ types(T)
5353
}
5454
`,
5555
`
56-
package r
56+
package p02
5757
5858
func f[T ~int]() {
5959
var x T
6060
print(x) //@ types(T)
6161
}
6262
`,
6363
`
64-
package s
64+
package p03
6565
6666
func a[T ~[4]byte](x T) {
6767
for k, v := range x {
@@ -96,26 +96,26 @@ func TestGenericBodies(t *testing.T) {
9696
9797
func From() {
9898
type A [4]byte
99-
print(a[A]) //@ types("func(x s.A)")
99+
print(a[A]) //@ types("func(x p03.A)")
100100
101101
type B *[4]byte
102-
print(b[B]) //@ types("func(x s.B)")
102+
print(b[B]) //@ types("func(x p03.B)")
103103
104104
type C []byte
105-
print(c[C]) //@ types("func(x s.C)")
105+
print(c[C]) //@ types("func(x p03.C)")
106106
107107
type D string
108-
print(d[D]) //@ types("func(x s.D)")
108+
print(d[D]) //@ types("func(x p03.D)")
109109
110110
type E map[int]string
111-
print(e[E]) //@ types("func(x s.E)")
111+
print(e[E]) //@ types("func(x p03.E)")
112112
113113
type F chan string
114-
print(f[F]) //@ types("func(x s.F)")
114+
print(f[F]) //@ types("func(x p03.F)")
115115
}
116116
`,
117117
`
118-
package t
118+
package p05
119119
120120
func f[S any, T ~chan S](x T) {
121121
for v := range x {
@@ -125,11 +125,11 @@ func TestGenericBodies(t *testing.T) {
125125
126126
func From() {
127127
type F chan string
128-
print(f[string, F]) //@ types("func(x t.F)")
128+
print(f[string, F]) //@ types("func(x p05.F)")
129129
}
130130
`,
131131
`
132-
package u
132+
package p06
133133
134134
func fibonacci[T ~chan int](c, quit T) {
135135
x, y := 0, 1
@@ -155,24 +155,24 @@ func TestGenericBodies(t *testing.T) {
155155
type F chan int
156156
c := make(F)
157157
quit := make(F)
158-
print(start[F], c, quit) //@ types("func(c u.F, quit u.F)", "u.F", "u.F")
159-
print(fibonacci[F], c, quit) //@ types("func(c u.F, quit u.F)", "u.F", "u.F")
158+
print(start[F], c, quit) //@ types("func(c p06.F, quit p06.F)", "p06.F", "p06.F")
159+
print(fibonacci[F], c, quit) //@ types("func(c p06.F, quit p06.F)", "p06.F", "p06.F")
160160
}
161161
`,
162162
`
163-
package v
163+
package p07
164164
165165
func f[T ~struct{ x int; y string }](i int) T {
166166
u := []T{ T{0, "lorem"}, T{1, "ipsum"}}
167167
return u[i]
168168
}
169169
func From() {
170170
type S struct{ x int; y string }
171-
print(f[S]) //@ types("func(i int) v.S")
171+
print(f[S]) //@ types("func(i int) p07.S")
172172
}
173173
`,
174174
`
175-
package w
175+
package p08
176176
177177
func f[T ~[4]int8](x T, l, h int) []int8 {
178178
return x[l:h]
@@ -189,11 +189,11 @@ func TestGenericBodies(t *testing.T) {
189189
type H []int32
190190
print(f[F](F{}, 0, 0)) //@ types("[]int8")
191191
print(g[G](nil, 0, 0)) //@ types("[]int16")
192-
print(h[H](nil, 0, 0)) //@ types("w.H")
192+
print(h[H](nil, 0, 0)) //@ types("p08.H")
193193
}
194194
`,
195195
`
196-
package x
196+
package p09
197197
198198
func h[E any, T ~[]E](x T, l, h int) []E {
199199
s := x[l:h]
@@ -206,7 +206,7 @@ func TestGenericBodies(t *testing.T) {
206206
}
207207
`,
208208
`
209-
package y
209+
package p10
210210
211211
// Test "make" builtin with different forms on core types and
212212
// when capacities are constants or variable.
@@ -236,7 +236,7 @@ func TestGenericBodies(t *testing.T) {
236236
}
237237
`,
238238
`
239-
package z
239+
package p11
240240
241241
func h[T ~[4]int](x T) {
242242
print(len(x), cap(x)) //@ types(int, int)
@@ -253,7 +253,7 @@ func TestGenericBodies(t *testing.T) {
253253
}
254254
`,
255255
`
256-
package a
256+
package p12
257257
258258
func f[E any, F ~func() E](x F) {
259259
print(x, x()) //@ types(F, E)
@@ -265,7 +265,7 @@ func TestGenericBodies(t *testing.T) {
265265
}
266266
`,
267267
`
268-
package b
268+
package p13
269269
270270
func f[E any, M ~map[string]E](m M) {
271271
y, ok := m["lorem"]
@@ -277,7 +277,7 @@ func TestGenericBodies(t *testing.T) {
277277
}
278278
`,
279279
`
280-
package c
280+
package p14
281281
282282
func a[T interface{ []int64 | [5]int64 }](x T) int64 {
283283
print(x, x[2], x[3]) //@ types(T, int64, int64)
@@ -318,25 +318,25 @@ func TestGenericBodies(t *testing.T) {
318318
}
319319
`,
320320
`
321-
package d
321+
package p15
322322
323323
type MyInt int
324324
type Other int
325325
type MyInterface interface{ foo() }
326326
327327
// ChangeType tests
328-
func ct0(x int) { v := MyInt(x); print(x, v) /*@ types(int, "d.MyInt")*/ }
328+
func ct0(x int) { v := MyInt(x); print(x, v) /*@ types(int, "p15.MyInt")*/ }
329329
func ct1[T MyInt | Other, S int ](x S) { v := T(x); print(x, v) /*@ types(S, T)*/ }
330330
func ct2[T int, S MyInt | int ](x S) { v := T(x); print(x, v) /*@ types(S, T)*/ }
331331
func ct3[T MyInt | Other, S MyInt | int ](x S) { v := T(x) ; print(x, v) /*@ types(S, T)*/ }
332332
333333
// Convert tests
334-
func co0[T int | int8](x MyInt) { v := T(x); print(x, v) /*@ types("d.MyInt", T)*/}
335-
func co1[T int | int8](x T) { v := MyInt(x); print(x, v) /*@ types(T, "d.MyInt")*/ }
334+
func co0[T int | int8](x MyInt) { v := T(x); print(x, v) /*@ types("p15.MyInt", T)*/}
335+
func co1[T int | int8](x T) { v := MyInt(x); print(x, v) /*@ types(T, "p15.MyInt")*/ }
336336
func co2[S, T int | int8](x T) { v := S(x); print(x, v) /*@ types(T, S)*/ }
337337
338338
// MakeInterface tests
339-
func mi0[T MyInterface](x T) { v := MyInterface(x); print(x, v) /*@ types(T, "d.MyInterface")*/ }
339+
func mi0[T MyInterface](x T) { v := MyInterface(x); print(x, v) /*@ types(T, "p15.MyInterface")*/ }
340340
341341
// NewConst tests
342342
func nc0[T any]() { v := (*T)(nil); print(v) /*@ types("*T")*/}
@@ -346,43 +346,51 @@ func TestGenericBodies(t *testing.T) {
346346
func sl1[T *[4]int | *[2]int, S []int](x S) { v := T(x); print(x, v) /*@ types(S, T)*/ }
347347
`,
348348
`
349-
package e
349+
package p16
350350
351351
func c[T interface{ foo() string }](x T) {
352352
print(x, x.foo, x.foo()) /*@ types(T, "func() string", string)*/
353353
}
354354
`,
355-
`package f
355+
`
356+
package p17
356357
357358
func eq[T comparable](t T, i interface{}) bool {
358359
return t == i
359360
}
360361
`,
361362
// TODO(59983): investigate why writing g.c panics in (*FieldAddr).String.
362-
`package g
363+
`
364+
package p18
365+
363366
type S struct{ f int }
364367
func c[P *S]() []P { return []P{{f: 1}} }
365368
`,
366-
`package h
369+
`
370+
package p19
371+
367372
func sign[bytes []byte | string](s bytes) (bool, bool) {
368373
neg := false
369374
if len(s) > 0 && (s[0] == '-' || s[0] == '+') {
370375
neg = s[0] == '-'
371376
s = s[1:]
372377
}
373378
return !neg, len(s) > 0
374-
}`,
375-
`package i
379+
}
380+
`,
381+
`package p20
382+
376383
func digits[bytes []byte | string](s bytes) bool {
377384
for _, c := range []byte(s) {
378385
if c < '0' || '9' < c {
379386
return false
380387
}
381388
}
382389
return true
383-
}`,
390+
}
391+
`,
384392
`
385-
package j
393+
package p21
386394
387395
type E interface{}
388396
@@ -394,7 +402,7 @@ func TestGenericBodies(t *testing.T) {
394402
}
395403
`,
396404
`
397-
package k
405+
package p22
398406
399407
func f[M any, PM *M](p PM) {
400408
var m M
@@ -404,7 +412,7 @@ func TestGenericBodies(t *testing.T) {
404412
}
405413
`,
406414
`
407-
package l
415+
package p23
408416
409417
type A struct{int}
410418
func (*A) Marker() {}
@@ -422,10 +430,11 @@ func TestGenericBodies(t *testing.T) {
422430
Marker()
423431
}](v T) {
424432
v.Marker()
425-
a := *(any(v).(*A)); print(a) /*@ types("l.A")*/
426-
b := *(any(v).(*B)); print(b) /*@ types("l.B")*/
427-
c := *(any(v).(*C)); print(c) /*@ types("l.C")*/
428-
}`,
433+
a := *(any(v).(*A)); print(a) /*@ types("p23.A")*/
434+
b := *(any(v).(*B)); print(b) /*@ types("p23.B")*/
435+
c := *(any(v).(*C)); print(c) /*@ types("p23.C")*/
436+
}
437+
`,
429438
} {
430439
contents := contents
431440
pkgname := packageName(t, contents)

0 commit comments

Comments
 (0)