Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for testTypeSwitch (0.62 sec)

  1. src/cmd/cover/testdata/test.go

    const anything = 1e9 // Just some unlikely value that means "we got here, don't care how often"
    
    func testAll() {
    	testSimple()
    	testBlockRun()
    	testIf()
    	testFor()
    	testRange()
    	testSwitch()
    	testTypeSwitch()
    	testSelect1()
    	testSelect2()
    	testPanic()
    	testEmptySwitches()
    	testFunctionLiteral()
    	testGoto()
    }
    
    // The indexes of the counters in testPanic are known to main.go
    const panicIndex = 3
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 4.9K bytes
    - Viewed (0)
  2. src/runtime/gc_test.go

    			case <-done:
    				return
    			default:
    				runtime.GC()
    			}
    		}
    	}()
    	for i := 0; i < 1e4; i++ {
    		func() {
    			defer print("")
    		}()
    	}
    	close(done)
    }
    
    func testTypeSwitch(x any) error {
    	switch y := x.(type) {
    	case nil:
    		// ok
    	case error:
    		return y
    	}
    	return nil
    }
    
    func testAssert(x any) error {
    	if y, ok := x.(error); ok {
    		return y
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 05 22:33:52 UTC 2024
    - 17.6K bytes
    - Viewed (0)
Back to top