- Sort Score
- Result 10 results
- Languages All
Results 41 - 50 of 2,835 for panic2 (0.22 sec)
-
test/chan/select3.go
const never = "function did" func unreachable() { panic("control flow shouldn't reach here") } // Calls f and verifies that f always/never panics depending on signal. func testPanic(signal string, f func()) { defer func() { s := never if recover() != nil { s = always // f panicked } if s != signal { panic(signal + " panic") } }() f() }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat Jul 08 02:10:12 UTC 2017 - 4.1K bytes - Viewed (0) -
pkg/config/schema/codegen/templates/gvk.go.tmpl
{{- end }} } return schema.GroupVersionResource{}, false } // MustToGVR converts a GVK to a GVR, and panics if it cannot be converted // Warning: this is only safe for known types; do not call on arbitrary GVKs func MustToGVR(g config.GroupVersionKind) schema.GroupVersionResource { r, ok := ToGVR(g) if !ok { panic("unknown kind: " + g.String()) } return r } // FromGVR converts a GVR to a GVK.
Registered: Fri Jun 14 15:00:06 UTC 2024 - Last Modified: Mon Dec 04 03:54:51 UTC 2023 - 2K bytes - Viewed (0) -
src/sync/atomic/value.go
// Store sets the value of the [Value] v to val. // All calls to Store for a given Value must use values of the same concrete type. // Store of an inconsistent type panics, as does Store(nil). func (v *Value) Store(val any) { if val == nil { panic("sync/atomic: store of nil value into Value") } vp := (*efaceWords)(unsafe.Pointer(v)) vlp := (*efaceWords)(unsafe.Pointer(&val)) for { typ := LoadPointer(&vp.typ)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Feb 26 20:48:55 UTC 2024 - 5.9K bytes - Viewed (0) -
test/recover.go
defer func() { mustNotRecover() }() panic(1) } func test2() { // Recover only sees the panic argument // if it is called from a deferred call. // It does not see the panic when called from a call within a deferred call (too late) // nor does it see the panic when it *is* the deferred call (too early). defer mustRecover(2) defer recover() // should be no-op panic(2) } func test3() {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon May 02 13:43:18 UTC 2016 - 10.6K bytes - Viewed (0) -
src/cmd/go/testdata/script/test_json_panic_exit.txt
# 'go test -json' should say a test fails if it exits 1 and prints nothing. ! go test -json ./exit1main stdout '"Action":"fail".*\n\z' ! stdout '"Test":.*\n\z' # 'go test -json' should say a test fails if it panics. ! go test -json ./panic stdout '"Action":"fail".*\n\z' ! stdout '"Test":.*\n\z' -- go.mod -- module example.com/test go 1.14 -- pass/pass_test.go -- package pass_test import "testing"
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 26 19:50:36 UTC 2022 - 1.2K bytes - Viewed (0) -
src/slices/sort_test.go
emptySlice := []int{} if !panics(func() { Min(emptySlice) }) { t.Errorf("Min([]): got no panic, want panic") } if !panics(func() { Max(emptySlice) }) { t.Errorf("Max([]): got no panic, want panic") } if !panics(func() { MinFunc(emptySlice, intCmp) }) { t.Errorf("MinFunc([]): got no panic, want panic") } if !panics(func() { MaxFunc(emptySlice, intCmp) }) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 09 19:20:55 UTC 2024 - 9.5K bytes - Viewed (0) -
src/fmt/fmt_test.go
} } } // PanicS is a type that panics in String. type PanicS struct { message any } // Value receiver. func (p PanicS) String() string { panic(p.message) } // PanicGo is a type that panics in GoString. type PanicGo struct { message any } // Value receiver. func (p PanicGo) GoString() string { panic(p.message) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Mar 04 17:31:55 UTC 2024 - 58.6K bytes - Viewed (0) -
test/typeparam/smallest.go
~string } func Smallest[T Ordered](s []T) T { r := s[0] // panics if slice is empty for _, v := range s[1:] { if v < r { r = v } } return r } func main() { vec1 := []float64{5.3, 1.2, 32.8} vec2 := []string{"abc", "def", "aaa"} want1 := 1.2 if got := Smallest(vec1); got != want1 { panic(fmt.Sprintf("got %d, want %d", got, want1)) } want2 := "aaa"
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Mar 01 19:45:34 UTC 2022 - 825 bytes - Viewed (0) -
src/runtime/race/testdata/atomic_test.go
// the rest of the program. Used to hang indefinitely. func TestNoRaceAtomicCrash(t *testing.T) { var mutex sync.Mutex var nilptr *int32 panics := 0 defer func() { if x := recover(); x != nil { mutex.Lock() panics++ mutex.Unlock() } else { panic("no panic") } }() atomic.AddInt32(nilptr, 1) } func TestNoRaceDeferAtomicStore(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Nov 16 17:26:46 UTC 2020 - 4.9K bytes - Viewed (0) -
src/os/exec/internal/fdtest/exists_windows.go
// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build windows package fdtest // Exists is not implemented on windows and panics. func Exists(fd uintptr) bool { panic("unimplemented")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Nov 16 19:41:37 UTC 2021 - 305 bytes - Viewed (0)