Search Options

Results per page
Sort
Preferred Languages
Advance

Results 91 - 100 of 1,675 for mypanic (0.12 sec)

  1. test/fixedbugs/issue43942.go

    				defer func() {
    					defer func() {
    						expect(3, recover())
    					}()
    					defer panic(3)
    					panic(2)
    				}()
    				defer func() {
    					expect(1, recover())
    				}()
    				panic(1)
    			}()
    		}()
    	}()
    	func() {
    		for {
    			defer func() {
    				defer panic(5)
    			}()
    			break
    		}
    		panic(4)
    	}()
    }
    
    func expect(want, have interface{}) {
    	if want != have {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 16 01:54:23 UTC 2022
    - 726 bytes
    - Viewed (0)
  2. test/range4.go

    		println("wrong final i ranging over f:", i)
    		bad = true
    	}
    	if bad {
    		panic("testfunc3")
    	}
    }
    
    func func5() (int, int) {
    	for i := range yield4 {
    		return 10, i
    	}
    	panic("still here")
    }
    
    func testfunc5() {
    	x, y := func5()
    	if x != 10 || y != 1 {
    		println("wrong results", x, y, "want", 10, 1)
    		panic("testfunc5")
    	}
    }
    
    func func6() (z, w int) {
    	for i := range yield4 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 16:00:53 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. 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)
  10. src/crypto/cipher/example_test.go

    	block, err := aes.NewCipher(key)
    	if err != nil {
    		panic(err.Error())
    	}
    
    	// Never use more than 2^32 random nonces with a given key because of the risk of a repeat.
    	nonce := make([]byte, 12)
    	if _, err := io.ReadFull(rand.Reader, nonce); err != nil {
    		panic(err.Error())
    	}
    
    	aesgcm, err := cipher.NewGCM(block)
    	if err != nil {
    		panic(err.Error())
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 30 16:23:44 UTC 2018
    - 11.8K bytes
    - Viewed (0)
Back to top