Search Options

Results per page
Sort
Preferred Languages
Advance

Results 71 - 80 of 1,056 for mypanic (0.23 sec)

  1. test/fixedbugs/bug113.go

    	var v1 = i.(int)
    	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)
  2. test/ken/string.go

    	if len(c) != 6 {
    		print("len ", len(c))
    		panic("fail")
    	}
    
    	/* index strings */
    	for i := 0; i < len(c); i = i + 1 {
    		if c[i] != (a + b)[i] {
    			print("index ", i, " ", c[i], " ", (a + b)[i])
    			panic("fail")
    		}
    	}
    
    	/* slice strings */
    	print(c[0:3], c[3:])
    
    	print("\n")
    
    	/* create string with integer constant */
    	c = string('x')
    	if c != "x" {
    		panic("create int " + c)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 31 17:36:45 UTC 2018
    - 1.8K bytes
    - Viewed (0)
  3. src/internal/types/testdata/check/stmt1.go

    		}
    		return
    	}
    	; ; ;
    } /* ERROR "missing return" */
    
    func parenPanic() int {
    	((((((panic)))(0))))
    }
    
    func issue23218a() int {
    	{
    		panic := func(interface{}){}
    		panic(0)
    	}
    } /* ERROR "missing return" */
    
    func issue23218b() int {
    	{
    		panic := func(interface{}){}
    		((((panic))))(0)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 02:58:32 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  4. test/closedchan.go

    	default:
    		return false
    	case c <- x:
    		return true
    	}
    	panic("nbsend")
    }
    
    func (c SChan) Recv() int {
    	select {
    	case x := <-c:
    		return x
    	}
    	panic("recv")
    }
    
    func (c SChan) Nbrecv() (int, bool) {
    	select {
    	default:
    		return 0, false
    	case x := <-c:
    		return x, true
    	}
    	panic("nbrecv")
    }
    
    func (c SChan) Recv2() (int, bool) {
    	select {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 17 04:48:57 UTC 2012
    - 5.8K bytes
    - Viewed (0)
  5. test/fixedbugs/issue8947.go

    	p := T{0, 1}
    	switch p {
    	case T{0, 0}:
    		panic("wrong1")
    	case T{0, 1}:
    		// ok
    	default:
    		panic("wrong2")
    	}
    
    	if p == (T{0, 0}) {
    		panic("wrong3")
    	} else if p == (T{0, 1}) {
    		// ok
    	} else {
    		panic("wrong4")
    	}
    }
    
    type T struct {
    	V int
    }
    
    var X = T{}.V
    
    func f2() {
    	var x = T{}.V
    	if x != 0 {
    		panic("wrongx")
    	}
    	if X != 0 {
    		panic("wrongX")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 751 bytes
    - Viewed (0)
  6. test/typeparam/absdiffimp2.dir/main.go

    )
    
    func main() {
    	if got, want := a.OrderedAbsDifference(1.0, -2.0), 3.0; got != want {
    		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    	}
    	if got, want := a.OrderedAbsDifference(-1.0, 2.0), 3.0; got != want {
    		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    	}
    	if got, want := a.OrderedAbsDifference(-20, 15), 35; got != want {
    		panic(fmt.Sprintf("got = %v, want = %v", got, want))
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 24 02:14:15 UTC 2022
    - 879 bytes
    - Viewed (0)
  7. test/typeparam/settable.go

    	if len(s) != 1 || s[0] != 1 {
    		panic(fmt.Sprintf("got %v, want %v", s, []int{1}))
    	}
    
    	defer func() {
    		if recover() == nil {
    			panic("did not panic as expected")
    		}
    	}()
    	// This should type check but should panic at run time,
    	// because it will make a slice of *SettableInt and then call
    	// Set on a nil value.
    	fromStrings3[*SettableInt]([]string{"1"})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 23:48:58 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  8. test/bigmap.go

    		m[T{}] = V{1}
    		m[T{1}] = V{2}
    		if x, y := m[T{}][0], m[T{1}][0]; x != 1 || y != 2 {
    			println(x, y)
    			panic("bad map")
    		}
      	}
    	{
    		type T [100]byte
    		type V [1]byte
    		m := make(map[T]V)
    		m[T{}] = V{1}
    		m[T{1}] = V{2}
    		if x, y := m[T{}][0], m[T{1}][0]; x != 1 || y != 2 {
    			println(x, y)
    			panic("bad map")
    		}
    	}
    	{
    		type T [1]byte
    		type V [100]byte
    		m := make(map[T]V)
    		m[T{}] = V{1}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 25 02:41:07 UTC 2012
    - 2.5K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/endpoints/handlers/finisher/finisher_test.go

    		},
    		{
    			name:    "Panic is propagated up",
    			timeout: timeoutFunc,
    			fn: func() (runtime.Object, error) {
    				panic("my panic")
    			},
    			expectedObj:   nil,
    			expectedErr:   nil,
    			expectedPanic: "my panic",
    		},
    		{
    			name:    "Panic is propagated with stack",
    			timeout: timeoutFunc,
    			fn: func() (runtime.Object, error) {
    				panic("my panic")
    			},
    			expectedObj:   nil,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri May 07 14:20:33 UTC 2021
    - 8.2K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/internal/aliases/aliases_go121.go

    // It will never be created by go/types.
    type Alias struct{}
    
    func (*Alias) String() string         { panic("unreachable") }
    func (*Alias) Underlying() types.Type { panic("unreachable") }
    func (*Alias) Obj() *types.TypeName   { panic("unreachable") }
    func Rhs(alias *Alias) types.Type     { panic("unreachable") }
    
    // Unalias returns the type t for go <=1.21.
    func Unalias(t types.Type) types.Type { return t }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 962 bytes
    - Viewed (0)
Back to top