- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 35 for shouldPanic (0.3 sec)
-
test/fixedbugs/issue7550.go
// run // Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main func shouldPanic(f func()) { defer func() { if recover() == nil { panic("not panicking") } }() f() } func f() { length := int(^uint(0) >> 1)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Apr 03 02:44:44 UTC 2014 - 551 bytes - Viewed (0) -
test/fixedbugs/bug444.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 02 13:43:18 UTC 2016 - 645 bytes - Viewed (0) -
test/fixedbugs/issue6055.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 02 13:43:18 UTC 2016 - 563 bytes - Viewed (0) -
test/fixedbugs/issue29190.go
import ( "strings" ) type T struct{} const maxInt = int(^uint(0) >> 1) func main() { s := make([]T, maxInt) shouldPanic("len out of range", func() { s = append(s, T{}) }) var oneElem = make([]T, 1) shouldPanic("len out of range", func() { s = append(s, oneElem...) }) } func shouldPanic(str string, f func()) { defer func() { err := recover() if err == nil { panic("did not panic") }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Aug 08 16:58:57 UTC 2022 - 707 bytes - Viewed (0) -
test/fixedbugs/issue65417.go
import ( "strings" "unsafe" ) func main() { shouldPanic("runtime error: index out of range", func() { f(0) }) shouldPanic("runtime error: index out of range", func() { g(0) }) } func f[T byte](t T) { const str = "a" _ = str[unsafe.Sizeof(t)] } func g[T byte](t T) { const str = "a" _ = str[unsafe.Sizeof(t)+0] } func shouldPanic(str string, f func()) { defer func() { err := recover()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Feb 20 22:29:14 UTC 2024 - 752 bytes - Viewed (0) -
test/interface/fail.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 15 16:55:13 UTC 2014 - 544 bytes - Viewed (0) -
test/typeparam/dottype.go
} func main() { var i interface{} = int(3) var j I = myint(3) var x interface{} = float64(3) var y I = myfloat(3) println(f[int](i)) shouldpanic(func() { f[int](x) }) println(f2[int](i)) println(f2[int](x)) println(g[myint](j)) shouldpanic(func() { g[myint](y) }) println(g2[myint](j)) println(g2[myint](y)) println(h[int](struct{ a, b int }{3, 5}).a) println(k[int](mybar(3)).bar())
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 01 19:45:34 UTC 2022 - 1.4K bytes - Viewed (0) -
test/fixedbugs/issue15975.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jun 08 20:35:53 UTC 2016 - 572 bytes - Viewed (0) -
test/fixedbugs/bug148.go
if x == nil { return T{2, 3}; } t := x.(T); println(t.a, t.b); return x; } func main() { inner_T := f(nil); f(inner_T); shouldPanic(p1) } func p1() { outer_T := T{5, 7}; f(outer_T); } func shouldPanic(f func()) { defer func() { if recover() == nil { panic("function should panic") } }() f() } /* This prints: 2 3 5 7
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Feb 17 04:49:30 UTC 2012 - 750 bytes - Viewed (0) -
test/interface/noeq.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 02 13:43:18 UTC 2016 - 641 bytes - Viewed (0)