github.com/goplusjs/gopherjs@v1.2.6-0.20211206034512-f187917453b8/compiler/natives/src/reflect/go115_reflect_test.go (about) 1 // +build js 2 // +build go1.15 3 4 package reflect_test 5 6 import ( 7 "fmt" 8 . "reflect" 9 "strings" 10 "testing" 11 ) 12 13 func TestConvertNaNs(t *testing.T) { 14 t.Skip() 15 } 16 17 func shouldPanic(expect string, f func()) { 18 defer func() { 19 r := recover() 20 if r == nil { 21 panic("did not panic") 22 } 23 if expect != "" { 24 var s string 25 switch r := r.(type) { 26 case string: 27 s = r 28 case *ValueError: 29 s = r.Error() 30 default: 31 panic(fmt.Sprintf("panicked with unexpected type %T", r)) 32 } 33 if !strings.HasPrefix(s, "reflect") { 34 panic(`panic string does not start with "reflect": ` + s) 35 } 36 if !strings.Contains(s, expect) { 37 // panic(`panic string does not contain "` + expect + `": ` + s) 38 } 39 } 40 }() 41 f() 42 }