Search Options

Results per page
Sort
Preferred Languages
Advance

Results 161 - 170 of 1,675 for mypanic (0.12 sec)

  1. test/fixedbugs/bug119.go

    	return a[0] // this seems to do the wrong thing
    }
    
    func main() {
    	a := &[]int{12}
    	if x := (*a)[0]; x != 12 {
    		panic(2)
    	}
    	if x := foo(*a); x != 12 {
    		// fails (x is incorrect)
    		panic(3)
    	}
    }
    
    /*
    uetli:~/Source/go1/test/bugs gri$ 6go bug119
    3 70160
    
    panic on line 83 PC=0x14d6
    0x14d6?zi
    	mainĀ·main(23659, 0, 1, ...)
    	mainĀ·main(0x5c6b, 0x1, 0x7fff5fbff830, ...)
    0x52bb?zi
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 18 21:15:42 UTC 2012
    - 697 bytes
    - Viewed (0)
  2. test/func8.go

    	xy += "x"
    	return false
    }
    
    //go:noinline
    func y() string {
    	xy += "y"
    	return "abc"
    }
    
    func main() {
    	if f() == g() {
    		panic("wrong f,g order")
    	}
    
    	if x() == (y() == "abc") {
    		panic("wrong compare")
    	}
    	if xy != "xy" {
    		panic("wrong x,y order")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 599 bytes
    - Viewed (0)
  3. test/closure4.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Check that calling a nil func causes a proper panic.
    
    package main
    
    func main() {
    	defer func() {
    		err := recover()
    		if err == nil {
    			panic("panic expected")
    		}
    	}()
    
    	var f func()
    	f()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 14 09:19:38 UTC 2018
    - 364 bytes
    - Viewed (0)
  4. test/fixedbugs/bug012.go

    	var u31 uint64 = 1;
    	_, _ = u30, u31;
    	var u32 uint64 = 18446744073709551615;
    	var u33 uint64 = +18446744073709551615;
    	if u32 != (1<<64)-1 { panic("u32\n"); }
    	if u33 != (1<<64)-1 { panic("u33\n"); }
    	var i34 int64 = ^0;  // note: 2's complement means ^0 == -1
    	if i34 != -1 { panic("i34") }
    }
    /*
    bug12.go:5: overflow converting constant to <uint64>UINT64
    bug12.go:6: overflow converting constant to <uint64>UINT64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 17 04:48:57 UTC 2012
    - 756 bytes
    - Viewed (0)
  5. test/fixedbugs/issue9537.dir/b.go

    	var ix Intf = X{x}
    	t1 := ix.Get()
    	t2 := x.Get()
    	if !bytes.Equal(t1, t2) {
    		panic(t1)
    	}
    
    	p1 := ix.RetPtr(5)
    	p2 := x.RetPtr(7)
    	if *p1 != 6 || *p2 != 8 {
    		panic(*p1)
    	}
    
    	r1, r2 := ix.RetRPtr(10)
    	r3, r4 := x.RetRPtr(13)
    	if r1 != 11 || *r2 != 11 || r3 != 14 || *r4 != 14 {
    		panic("bad RetRPtr")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 22 03:25:12 UTC 2015
    - 678 bytes
    - Viewed (0)
  6. src/cmd/cgo/internal/testlife/life_test.go

    	GOPATH, err := os.MkdirTemp("", "cgolife")
    	if err != nil {
    		log.Panic(err)
    	}
    	defer os.RemoveAll(GOPATH)
    	os.Setenv("GOPATH", GOPATH)
    
    	// Copy testdata into GOPATH/src/cgolife, along with a go.mod file
    	// declaring the same path.
    	modRoot := filepath.Join(GOPATH, "src", "cgolife")
    	if err := cgotest.OverlayDir(modRoot, "testdata"); err != nil {
    		log.Panic(err)
    	}
    	if err := os.Chdir(modRoot); err != nil {
    		log.Panic(err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 22 20:56:09 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  7. test/fixedbugs/issue23837.go

    	n := 0
    	inc := func() struct{} {
    		n++
    		return struct{}{}
    	}
    	h(inc, inc)
    	if n != 2 {
    		panic("inc not called")
    	}
    	hi(inc, inc)
    	if n != 4 {
    		panic("inc not called")
    	}
    }
    
    func shouldPanic(x func()) {
    	defer func() {
    		if recover() == nil {
    			panic("did not panic")
    		}
    	}()
    	x()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 30 17:45:19 UTC 2018
    - 1.1K bytes
    - Viewed (0)
  8. internal/dsync/drwmutex_test.go

    			t.Fatalf("unlock of unlocked RWMutex did not panic")
    		}
    	}()
    	mu := NewDRWMutex(ds, "test")
    	mu.Unlock(context.Background())
    }
    
    // Borrowed from rwmutex_test.go
    func TestUnlockPanic2(t *testing.T) {
    	mu := NewDRWMutex(ds, "test-unlock-panic-2")
    	defer func() {
    		if recover() == nil {
    			t.Fatalf("unlock of unlocked RWMutex did not panic")
    		}
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Sat Dec 24 03:49:07 UTC 2022
    - 9.7K bytes
    - Viewed (0)
  9. test/fixedbugs/bug070.go

    import "fmt"
    
    func main() {
    	var i, k int
    	var r string
    outer:
    	for k = 0; k < 2; k++ {
    		r += fmt.Sprintln("outer loop top k", k)
    		if k != 0 {
    			panic("k not zero")
    		} // inner loop breaks this one every time
    		for i = 0; i < 2; i++ {
    			if i != 0 {
    				panic("i not zero")
    			} // loop breaks every time
    			r += fmt.Sprintln("inner loop top i", i)
    			if true {
    				r += "do break\n"
    				break outer
    			}
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 17 04:49:30 UTC 2012
    - 715 bytes
    - Viewed (0)
  10. test/typeparam/issue47258.go

    	x++
    	return x
    }
    func main() {
    	if got, want := inc(int32(5)), int32(6); got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    	if got, want := inc(float64(5)), float64(6.0); got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    	if got, want := inc(complex64(5)), complex64(6.0); got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 686 bytes
    - Viewed (0)
Back to top