Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 2,815 for panicCh (0.12 sec)

  1. 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)
  2. 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)
  3. test/recover1.go

    	defer mustNotRecover()
    	defer func() {
    		recover()
    		defer mustRecover(3)
    		panic(3)
    	}()
    	panic(2)
    }
    
    func test4() {
    	// Single panic.
    	defer mustNotRecover()
    	defer func() {
    		recover()
    	}()
    	panic(4)
    }
    
    func test5() {
    	// Single panic but recover called via defer
    	defer mustNotRecover()
    	defer func() {
    		defer recover()
    	}()
    	panic(5)
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 2.5K bytes
    - Viewed (0)
  4. src/cmd/vet/testdata/print/print.go

    	logpkg.Fatalln("%d", 1)  // ERROR "Fatalln call has possible Printf formatting directive %d"
    	logpkg.Panic("%d", 1)    // ERROR "Panic call has possible Printf formatting directive %d"
    	logpkg.Panicf("%d", "x") // ERROR "Panicf format %d has arg \x22x\x22 of wrong type string"
    	logpkg.Panicln("%d", 1)  // ERROR "Panicln call has possible Printf formatting directive %d"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 27.5K bytes
    - Viewed (0)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. 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)
Back to top