Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 1,938 for panics (0.13 sec)

  1. test/makeslice.go

    		testInts(1<<32 - 1)
    		testBytes(1<<32 - 1)
    	}
    }
    
    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) {
    			panic("got panic " + s + ", want " + str)
    		}
    	}()
    
    	f()
    }
    
    func testInts(n uint64) {
    	testMakeInts(n)
    	testMakeCopyInts(n)
    	testMakeInAppendInts(n)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 07 17:50:24 UTC 2020
    - 5.5K bytes
    - Viewed (0)
  2. 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)
  3. src/syscall/dll_windows.go

    		}
    	}
    	d := &DLL{
    		Name:   name,
    		Handle: Handle(h),
    	}
    	return d, nil
    }
    
    // MustLoadDLL is like [LoadDLL] but panics if load operation fails.
    func MustLoadDLL(name string) *DLL {
    	d, e := LoadDLL(name)
    	if e != nil {
    		panic(e)
    	}
    	return d
    }
    
    // FindProc searches [DLL] d for procedure named name and returns [*Proc]
    // if found. It returns an error if search fails.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:03:59 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  4. test/fixedbugs/issue20529.go

    //go:build amd64
    
    // Copyright 2017 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.
    
    // Issue 20529: Large stack frames caused compiler panics.
    // Only tested on amd64 because the test only makes sense
    // on a 64 bit system, and it is platform-agnostic,
    // so testing one suffices.
    
    package p
    
    import "runtime"
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 519 bytes
    - Viewed (0)
  5. test/typeparam/mdempsky/16.go

    // run
    
    // Copyright 2022 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.
    
    // Test that type assertion panics mention the real interface type,
    // not their shape type.
    
    package main
    
    import (
    	"fmt"
    	"runtime"
    	"strings"
    )
    
    func main() {
    	// The exact error message isn't important, but it should mention
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 10 21:35:49 UTC 2022
    - 722 bytes
    - Viewed (0)
  6. src/html/fuzz_test.go

    		}
    
    		// As per the documentation, this isn't always equal to v, so it makes
    		// no sense to check for equality. It can still be interesting to find
    		// panics in it though.
    		EscapeString(UnescapeString(v))
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 10 20:35:20 UTC 2023
    - 636 bytes
    - Viewed (0)
  7. src/crypto/subtle/xor.go

    // returning n, the number of bytes written to dst.
    // If dst does not have length at least n,
    // XORBytes panics without writing anything to dst.
    func XORBytes(dst, x, y []byte) int {
    	n := min(len(x), len(y))
    	if n == 0 {
    		return 0
    	}
    	if n > len(dst) {
    		panic("subtle.XORBytes: dst too short")
    	}
    	xorBytes(&dst[0], &x[0], &y[0], n) // arch-specific
    	return n
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 16 15:50:40 UTC 2024
    - 618 bytes
    - Viewed (0)
  8. test/fixedbugs/issue26043.go

    // license that can be found in the LICENSE file.
    
    // This program results in a loop inferred to increment
    // j by 0, causing bounds check elimination to attempt
    // something%0, which panics (in the bug).
    
    package q
    
    func f() {
    	var s1 string
    	var b bool
    	if b {
    		b = !b
    		s1 += "a"
    	}
    
    	var s2 string
    	var i, j int
    	if (s1 <= "") || (s2 >= "") {
    		j = len(s1[:6])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 25 20:36:42 UTC 2018
    - 543 bytes
    - Viewed (0)
  9. src/internal/types/testdata/fixedbugs/issue57522.go

    type S1[T any] V1.M /* ERROR "V1.M is not a type" */
    type V1 = S1[any]
    
    type S2[T any] struct{}
    type V2 = S2[any]
    func (fs *S2[T]) M(x V2.M /* ERROR "V2.M is not a type" */ ) {}
    
    // The following still panics, as the selector is reached from check.expr
    // rather than check.typexpr. TODO(rfindley): fix this.
    // type X[T any] int
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 11 22:29:34 UTC 2023
    - 728 bytes
    - Viewed (0)
  10. 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)
Back to top