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 7package main 8 9type TestSuite struct { 10 Tests []Test 11} 12type Test struct { 13 Want interface{} 14} 15type Int struct { 16 i int 17} 18 19func NewInt(v int) Int { 20 return Int{i: v} 21} 22 23var Suites = []TestSuite{ 24 Dicts, 25} 26var 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 39func main() { 40 if Suites[0].Tests[0].Want.(map[Int]bool)[NewInt(3)] { 41 panic("bad") 42 } 43} 44