Search Options

Results per page
Sort
Preferred Languages
Advance

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

  1. 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)
  2. test/typeparam/issue48317.go

    }
    
    func a[T any]() {
    	data := `{"t1":"1","t2":2,"t3":{"t4":4}}`
    	a1 := A[T]{}
    	if err := json.Unmarshal([]byte(data), &a1); err != nil {
    		panic(err)
    	}
    	if bytes, err := json.Marshal(&a1); err != nil {
    		panic(err)
    	} else if string(bytes) != data {
    		panic(string(bytes))
    	}
    }
    
    func main() {
    	a[int]()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 648 bytes
    - Viewed (0)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. 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)
  9. src/cmd/cgo/internal/testplugin/testdata/issue18584/main.go

    package main
    
    import "plugin"
    
    func main() {
    	p, err := plugin.Open("plugin.so")
    	if err != nil {
    		panic(err)
    	}
    
    	sym, err := p.Lookup("G")
    	if err != nil {
    		panic(err)
    	}
    	g := sym.(func() bool)
    	if !g() {
    		panic("expected types to match, Issue #18584")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 424 bytes
    - Viewed (0)
  10. src/cmd/go/testdata/script/vendor_issue12156.txt

    # Tests issue #12156, a former index out of range panic.
    
    env GO111MODULE=off
    env GOPATH=$WORK/gopath/src/testvendor2 # vendor/x is directly in $GOPATH, not in $GOPATH/src
    cd $WORK/gopath/src/testvendor2/src/p
    
    ! go build p.go
    ! stderr panic # Make sure it doesn't panic
    stderr 'cannot find package "x"'
    
    -- testvendor2/src/p/p.go --
    package p
    
    import "x"
    -- testvendor2/vendor/x/x.go --
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Sep 17 13:25:29 UTC 2020
    - 398 bytes
    - Viewed (0)
Back to top