Debian Codegraph @

test/fixedbugs/issue29013b.go

raw
1 // run
2
3 // Copyright 2018 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
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 }