Search Options

Results per page
Sort
Preferred Languages
Advance

Results 101 - 110 of 1,056 for mypanic (0.1 sec)

  1. test/defernil.go

    // Check that deferring a nil function causes a proper
    // panic when the deferred function is invoked (not
    // when the function is deferred).
    // See Issue #8047 and #34926.
    
    package main
    
    var x = 0
    
    func main() {
    	defer func() {
    		err := recover()
    		if err == nil {
    			panic("did not panic")
    		}
    		if x != 1 {
    			panic("FAIL")
    		}
    	}()
    	f()
    }
    
    func f() {
    	var nilf func()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 16 00:05:37 UTC 2019
    - 563 bytes
    - Viewed (0)
  2. test/fixedbugs/issue8606.go

    			defer func() {
    				if recover() != nil {
    					panic(fmt.Sprintf("comparing %#v and %#v panicked", test.a, test.b))
    				}
    			}()
    			if test.a == test.b {
    				panic(fmt.Sprintf("values %#v and %#v should not be equal", test.a, test.b))
    			}
    		}
    		if test.panic {
    			shouldPanic(fmt.Sprintf("comparing %#v and %#v did not panic", test.a, test.b), f)
    		} else {
    			f() // should not panic
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 21:55:14 UTC 2023
    - 2.3K bytes
    - Viewed (0)
  3. src/cmd/go/testdata/script/test_json_exit.txt

    import "testing"
    
    func TestMain(m *testing.M) {
    	panic("haha no")
    }
    -- mainexit0/mainexit0_test.go --
    package mainexit0_test
    
    import (
    	"fmt"
    	"os"
    	"testing"
    )
    
    func TestMain(m *testing.M) {
    	fmt.Println("nothing to do")
    	os.Exit(0)
    }
    -- testpanic/testpanic_test.go --
    package testpanic_test
    
    import "testing"
    
    func TestPanic(*testing.T) {
    	panic("haha no")
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 17 19:43:21 UTC 2020
    - 2K bytes
    - Viewed (0)
  4. test/typeparam/index.go

    	vec1 := []string{"ab", "cd", "ef"}
    	if got := Index(vec1, "ef"); got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    
    	vec2 := []byte{'c', '6', '@'}
    	if got := Index(vec2, '@'); got != want {
    		panic(fmt.Sprintf("got %d, want %d", got, want))
    	}
    
    	vec3 := []*obj{&obj{2}, &obj{42}, &obj{1}}
    	if got := Index(vec3, vec3[2]); 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
    - 1.5K bytes
    - Viewed (0)
  5. src/net/http/omithttp2.go

    	MaxHeaderListSize uint32
    	ConnPool          any
    }
    
    func (*http2Transport) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    func (*http2Transport) CloseIdleConnections()                 {}
    
    type http2noDialH2RoundTripper struct{}
    
    func (http2noDialH2RoundTripper) RoundTrip(*Request) (*Response, error) { panic(noHTTP2) }
    
    type http2noDialClientConnPool struct {
    	http2clientConnPool http2clientConnPool
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 22 20:51:27 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  6. test/fixedbugs/issue50672.go

    }
    
    func g() (int, int) {
    	if !ok {
    		panic("FAIL")
    	}
    	return 0, 0
    }
    
    var _ = f()(g())
    
    func main() {
    	f1()
    	f2()
    	f3()
    	f4()
    }
    
    func f1() {
    	ok := false
    
    	f := func() func(int, int) {
    		ok = true
    		return func(int, int) {}
    	}
    	g := func() (int, int) {
    		if !ok {
    			panic("FAIL")
    		}
    		return 0, 0
    	}
    
    	f()(g())
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 11 08:12:15 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  7. src/cmd/go/testdata/script/test_exit.txt

    env GO111MODULE=on
    
    # If a test invoked by 'go test' exits with a zero status code,
    # it will panic.
    ! go test ./zero
    ! stdout ^ok
    ! stdout 'exit status'
    stdout 'panic'
    stdout ^FAIL
    
    # If a test exits with a non-zero status code, 'go test' fails normally.
    ! go test ./one
    ! stdout ^ok
    stdout 'exit status'
    ! stdout 'panic'
    stdout ^FAIL
    
    # Ensure that other flags still do the right thing.
    go test -list=. ./zero
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 14 20:38:03 UTC 2021
    - 2.5K bytes
    - Viewed (0)
  8. pkg/config/schema/kubetypes/common.go

    	if gk, ok := getGvk(ptr.Empty[T]()); ok {
    		gr, ok := gvk.ToGVR(gk)
    		if !ok {
    			panic(fmt.Sprintf("unknown GVR for GVK %v", gk))
    		}
    		return gr
    	}
    	if rp := typemap.Get[RegisterType[T]](registeredTypes); rp != nil {
    		return (*rp).GetGVR()
    	}
    	panic("unknown kind: " + ptr.TypeName[T]())
    }
    
    func MustGVKFromType[T runtime.Object]() (cfg config.GroupVersionKind) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Wed Apr 17 16:38:40 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  9. test/args.go

    // license that can be found in the LICENSE file.
    
    // Test os.Args.
    
    package main
    
    import "os"
    
    func main() {
    	if len(os.Args) != 3 {
    		panic("argc")
    	}
    	if os.Args[1] != "arg1" {
    		panic("arg1")
    	}
    	if os.Args[2] != "arg2" {
    		panic("arg2")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 08 17:04:27 UTC 2012
    - 374 bytes
    - Viewed (0)
  10. test/fixedbugs/issue53635.go

    package main
    
    func main() {
    	f[int]()
    }
    
    func f[T any]() {
    	switch []T(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    
    	switch (func() T)(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    
    	switch (map[int]T)(nil) {
    	case nil:
    	default:
    		panic("FAIL")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jul 08 12:57:49 UTC 2022
    - 423 bytes
    - Viewed (0)
Back to top