Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for shouldPanic (0.27 sec)

  1. test/makeslice.go

    func testMakeInts(n uint64) {
    	type T []int
    	shouldPanic("len out of range", func() { _ = make(T, int(n)) })
    	shouldPanic("cap out of range", func() { _ = make(T, 0, int(n)) })
    	shouldPanic("len out of range", func() { _ = make(T, uint(n)) })
    	shouldPanic("cap out of range", func() { _ = make(T, 0, uint(n)) })
    	shouldPanic("len out of range", func() { _ = make(T, int64(n)) })
    	shouldPanic("cap out of range", func() { _ = make(T, 0, int64(n)) })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 07 17:50:24 UTC 2020
    - 5.5K bytes
    - Viewed (0)
  2. test/fixedbugs/issue4085b.go

    		shouldPanic("cap out of range", func() { _ = make(T, 0, x) })
    		testMakeInAppend(int(x))
    	} else {
    		n = 1<<31 - 1
    		shouldPanic("len out of range", func() { _ = make(T, n) })
    		shouldPanic("cap out of range", func() { _ = make(T, 0, n) })
    		shouldPanic("len out of range", func() { _ = make(T, int64(n)) })
    		shouldPanic("cap out of range", func() { _ = make(T, 0, int64(n)) })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 17 17:18:17 UTC 2019
    - 2.9K bytes
    - Viewed (0)
  3. test/fixedbugs/issue23837.go

    	return p.x == q.x
    }
    
    func hi(p, q func() struct{}) bool {
    	return p() == q()
    }
    
    func main() {
    	shouldPanic(func() { f(nil, nil) })
    	shouldPanic(func() { g(nil, nil) })
    	shouldPanic(func() { h(nil, nil) })
    	shouldPanic(func() { fi(nil, nil) })
    	shouldPanic(func() { gi(nil, nil) })
    	shouldPanic(func() { hi(nil, nil) })
    	n := 0
    	inc := func() struct{} {
    		n++
    		return struct{}{}
    	}
    	h(inc, inc)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 30 17:45:19 UTC 2018
    - 1.1K bytes
    - Viewed (0)
  4. test/nilptr.go

    		panic("dummy too far out")
    	}
    
    	shouldPanic(p1)
    	shouldPanic(p2)
    	shouldPanic(p3)
    	shouldPanic(p4)
    	shouldPanic(p5)
    	shouldPanic(p6)
    	shouldPanic(p7)
    	shouldPanic(p8)
    	shouldPanic(p9)
    	shouldPanic(p10)
    	shouldPanic(p11)
    	shouldPanic(p12)
    	shouldPanic(p13)
    	shouldPanic(p14)
    	shouldPanic(p15)
    	shouldPanic(p16)
    }
    
    func shouldPanic(f func()) {
    	defer func() {
    		if recover() == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 3.2K bytes
    - Viewed (0)
  5. test/nilptr_aix.go

    		panic("dummy not far enough")
    	}
    
    	shouldPanic(p1)
    	shouldPanic(p2)
    	shouldPanic(p3)
    	shouldPanic(p4)
    	shouldPanic(p5)
    	shouldPanic(p6)
    	shouldPanic(p7)
    	shouldPanic(p8)
    	shouldPanic(p9)
    	shouldPanic(p10)
    	shouldPanic(p11)
    	shouldPanic(p12)
    	shouldPanic(p13)
    	shouldPanic(p14)
    	shouldPanic(p15)
    	shouldPanic(p16)
    }
    
    func shouldPanic(f func()) {
    	defer func() {
    		if recover() == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  6. test/fixedbugs/issue29504.go

    	})
    	shouldPanic(func() {
    		var a [3]int
    		a /*line :999999:1*/ [ /*line :500:1*/ i] = 1
    	})
    	shouldPanic(func() {
    		var a []int
    		a /*line :999999:1*/ [ /*line :600:1*/ i] = 1
    	})
    
    	shouldPanic(func() {
    		var a [3]T
    		sinkT = a /*line :999999:1*/ [ /*line :700:1*/ i]
    	})
    	shouldPanic(func() {
    		var a []T
    		sinkT = a /*line :999999:1*/ [ /*line :800:1*/ i]
    	})
    	shouldPanic(func() {
    		var a [3]T
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 30 21:30:30 UTC 2019
    - 2.9K bytes
    - Viewed (0)
  7. test/chancap.go

    		panic("fail")
    	}
    
    	n := -1
    	shouldPanic("makechan: size out of range", func() { _ = make(T, n) })
    	shouldPanic("makechan: size out of range", func() { _ = make(T, int64(n)) })
    	if ptrSize == 8 {
    		// Test mem > maxAlloc
    		var n2 int64 = 1 << 59
    		shouldPanic("makechan: size out of range", func() { _ = make(T, int(n2)) })
    		// Test elem.size*cap overflow
    		n2 = 1<<63 - 1
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 26 14:06:28 UTC 2018
    - 1.6K bytes
    - Viewed (0)
  8. src/reflect/nih_test.go

    	v := ValueOf((*nih)(nil))
    	v.Elem()
    	shouldPanic("reflect: call of reflect.Value.Field on zero Value", func() { v.Elem().Field(0) })
    
    	v = ValueOf(&global_nih)
    	if got := v.Elem().Field(1).Int(); got != 7 {
    		t.Fatalf("got %d, want 7", got)
    	}
    
    	v = ValueOf((*nih)(unsafe.Pointer(new(int))))
    	shouldPanic("reflect: reflect.Value.Elem on an invalid notinheap pointer", func() { v.Elem() })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 31 01:16:54 UTC 2022
    - 1004 bytes
    - Viewed (0)
  9. test/method5.go

    	var f func(int, byte) (byte, int)
    	shouldPanic(func() { psv = nil; f = psv.M })
    	shouldPanic(func() { pwv = nil; f = pwv.M })
    	shouldPanic(func() { pbv = nil; f = pbv.M })
    	shouldPanic(func() { var i Tinter; f = i.M })
    	shouldPanic(func() { _psv = nil; f = _psv.m })
    	shouldPanic(func() { _pwv = nil; f = _pwv.m })
    	shouldPanic(func() { _pbv = nil; f = _pbv.m })
    	shouldPanic(func() { var _i tinter; f = _i.m })
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 6.7K bytes
    - Viewed (0)
  10. test/nil.go

    	if s != 45 {
    		panic(s)
    	}
    
    	s = 0
    	for i := 0; i < len(p); i++ {
    		s += i
    	}
    	if s != 45 {
    		panic(s)
    	}
    
    	// Looping over values is not.
    	shouldPanic(func() {
    		for i, v := range p {
    			s += i + v
    		}
    	})
    
    	shouldPanic(func() {
    		for i := 0; i < len(p); i++ {
    			s += p[i]
    		}
    	})
    }
    
    // nil channel
    // select tests already handle select on nil channel
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 12 18:17:49 UTC 2013
    - 2.2K bytes
    - Viewed (0)
Back to top