Source file
test/fixedbugs/issue29013b.go
1
2
3
4
5
6
7 package main
8
9 type TestSuite struct {
10 Tests []Test
11 }
12 type Test struct {
13 Want interface{}
14 }
15 type Int struct {
16 i int
17 }
18
19 func NewInt(v int) Int {
20 return Int{i: v}
21 }
22
23 var Suites = []TestSuite{
24 Dicts,
25 }
26 var Dicts = TestSuite{
27 Tests: []Test{
28 {
29 Want: map[Int]bool{NewInt(1): true},
30 },
31 {
32 Want: map[Int]string{
33 NewInt(3): "3",
34 },
35 },
36 },
37 }
38
39 func main() {
40 if Suites[0].Tests[0].Want.(map[Int]bool)[NewInt(3)] {
41 panic("bad")
42 }
43 }
44
View as plain text