- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 35 for shouldPanic (0.13 sec)
-
test/interface/returntype.go
func (t *T) Name() int64 { return 64 } type I1 interface { Name() int8 } type I2 interface { Name() int64 } func main() { shouldPanic(p1) } func p1() { var i1 I1 var s *S i1 = s print(i1.(I2).Name()) } func shouldPanic(f func()) { defer func() { if recover() == nil { panic("function should panic") } }() f()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sun Feb 19 06:33:41 UTC 2012 - 670 bytes - Viewed (0) -
test/fixedbugs/bug113.go
if foo1(v1) != 1 { panic(1) } var v2 = int32(i.(int)) if foo2(v2) != 1 { panic(2) } shouldPanic(p1) } func p1() { var i I i = 1 var v3 = i.(int32) // This type conversion should fail at runtime. if foo2(v3) != 1 { panic(3) } } func shouldPanic(f func()) { defer func() { if recover() == nil { panic("function should panic") } }() f()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Feb 17 04:49:30 UTC 2012 - 693 bytes - Viewed (0) -
test/closedchan.go
} // send should work with ,ok too: sent a value without blocking, so ok == true. shouldPanic(func() { c.Nbsend(1) }) // the value should have been discarded. if x := c.Recv(); x != 0 { println("test1: recv on closed got non-zero after send on closed:", x, c.Impl()) failed = true } // similarly Send. shouldPanic(func() { c.Send(2) }) if x := c.Recv(); x != 0 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Feb 17 04:48:57 UTC 2012 - 5.8K bytes - Viewed (0) -
test/fixedbugs/issue60601.go
} func main() { shift[[62]byte]() shift[[63]byte]() shift[[64]byte]() shift[[100]byte]() shift[[1e6]byte]() add[[1]byte]() shouldPanic("divide by zero", func() { div[[0]byte]() }) } func shouldPanic(str string, f func()) { defer func() { err := recover() if err == nil { panic("did not panic") } s := err.(error).Error() if !strings.Contains(s, str) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jun 15 18:41:09 UTC 2023 - 862 bytes - Viewed (0) -
test/fixedbugs/issue37975.go
tests := []struct { f func() panicStr string }{ {capOutOfRange, "cap out of range"}, {lenOutOfRange, "len out of range"}, } for _, tc := range tests { shouldPanic(tc.panicStr, tc.f) } } func shouldPanic(str string, f func()) { defer func() { err := recover() runtimeErr := err.(error).Error() if !strings.Contains(runtimeErr, str) { panic("got panic " + runtimeErr + ", want " + str)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 31 21:51:51 UTC 2020 - 979 bytes - Viewed (0) -
src/reflect/all_test.go
xa := [8]int{10, 20, 30, 40, 50, 60, 70, 80} vs := ValueOf(&xs).Elem() shouldPanic("SetLen", func() { vs.SetLen(10) }) shouldPanic("SetCap", func() { vs.SetCap(10) }) shouldPanic("SetLen", func() { vs.SetLen(-1) }) shouldPanic("SetCap", func() { vs.SetCap(-1) }) shouldPanic("SetCap", func() { vs.SetCap(6) }) // smaller than len vs.SetLen(5) if len(xs) != 5 || cap(xs) != 8 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 218.8K bytes - Viewed (0) -
src/internal/runtime/atomic/atomic_test.go
p64 := (*int64)(u) // misaligned shouldPanic(t, "Load64", func() { atomic.Load64(up64) }) shouldPanic(t, "Loadint64", func() { atomic.Loadint64(p64) }) shouldPanic(t, "Store64", func() { atomic.Store64(up64, 0) }) shouldPanic(t, "Xadd64", func() { atomic.Xadd64(up64, 1) }) shouldPanic(t, "Xchg64", func() { atomic.Xchg64(up64, 1) }) shouldPanic(t, "Cas64", func() { atomic.Cas64(up64, 1, 2) }) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Mar 25 19:53:03 UTC 2024 - 8.5K bytes - Viewed (0) -
test/cmp.go
istrue(x == y) istrue(bool(b)) m := make(map[string][10]interface{}) b = m["x"] == m["y"] istrue(m["x"] == m["y"]) istrue(bool(b)) } shouldPanic(p1) shouldPanic(p2) shouldPanic(p3) shouldPanic(p4) } func p1() { var a []int var ia interface{} = a use(ia == ia) } func p2() { var b []int var ib interface{} = b use(ib == ib) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Jun 26 03:38:21 UTC 2015 - 7.6K bytes - Viewed (0) -
test/fixedbugs/issue19113.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Feb 15 23:13:09 UTC 2019 - 1.8K bytes - Viewed (0) -
test/fixedbugs/issue8606.go
if test.a == test.b { panic(fmt.Sprintf("values %#v and %#v should not be equal", test.a, test.b)) } } if test.panic { shouldPanic(fmt.Sprintf("comparing %#v and %#v did not panic", test.a, test.b), f) } else { f() // should not panic } } } func shouldPanic(name string, f func()) { defer func() { if recover() == nil { panic(name) } }() f()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 24 21:55:14 UTC 2023 - 2.3K bytes - Viewed (0)