Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for testPanics (0.45 sec)

  1. src/runtime/testdata/testexithooks/testexithooks.go

    func main() {
    	flag.Parse()
    	switch *modeflag {
    	case "simple":
    		testSimple()
    	case "goodexit":
    		testGoodExit()
    	case "badexit":
    		testBadExit()
    	case "panics":
    		testPanics()
    	case "callsexit":
    		testHookCallsExit()
    	case "exit2":
    		testExit2()
    	default:
    		panic("unknown mode")
    	}
    }
    
    func testSimple() {
    	f1 := func() { println("foo") }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 16:41:13 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  2. src/runtime/ehooks_test.go

    				expected: "orange apple",
    			},
    			{
    				mode:     "badexit",
    				expected: "blub blix",
    			},
    			{
    				mode: "panics",
    				musthave: []string{
    					"fatal error: exit hook invoked panic",
    					"main.testPanics",
    				},
    			},
    			{
    				mode: "callsexit",
    				musthave: []string{
    					"fatal error: exit hook invoked exit",
    				},
    			},
    			{
    				mode:     "exit2",
    				expected: "",
    			},
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 16:41:13 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  3. src/log/slog/logger_test.go

    	msg any
    }
    
    func (p panicTextAndJsonMarshaler) MarshalText() ([]byte, error) {
    	panic(p.msg)
    }
    
    func (p panicTextAndJsonMarshaler) MarshalJSON() ([]byte, error) {
    	panic(p.msg)
    }
    
    func TestPanics(t *testing.T) {
    	// Revert any changes to the default logger. This is important because other
    	// tests might change the default logger using SetDefault. Also ensure we
    	// restore the default logger at the end of the test.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 10 21:25:30 UTC 2023
    - 19.5K bytes
    - Viewed (0)
  4. src/fmt/fmt_test.go

    	{"%s", (*PanicF)(nil), "<nil>"}, // nil pointer special case
    	{"%s", PanicF{io.ErrUnexpectedEOF}, "%!s(PANIC=Format method: unexpected EOF)"},
    	{"%s", PanicF{3}, "%!s(PANIC=Format method: 3)"},
    }
    
    func TestPanics(t *testing.T) {
    	for i, tt := range panictests {
    		s := Sprintf(tt.fmt, tt.in)
    		if s != tt.out {
    			t.Errorf("%d: %q: got %q expected %q", i, tt.fmt, s, tt.out)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:31:55 UTC 2024
    - 58.6K bytes
    - Viewed (0)
  5. src/cmd/go/testdata/script/test_json_exit.txt

    # Test functions that panic should never be marked as passing
    # (https://golang.org/issue/40132).
    
    ! go test -json ./testpanic
    stdout '"Action":"fail"'
    ! stdout '"Action":"pass"'
    
    ! go tool test2json ./testpanic.exe -test.v
    stdout '"Action":"fail"'
    ! stdout '"Action":"pass"'
    
    ! go tool test2json ./testpanic.exe
    stdout '"Action":"fail"'
    ! stdout '"Action":"pass"'
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 17 19:43:21 UTC 2020
    - 2K bytes
    - Viewed (0)
  6. src/cmd/internal/test2json/testdata/panic.json

    {"Action":"start"}
    {"Action":"output","Test":"TestPanic","Output":"--- FAIL: TestPanic (0.00s)\n"}
    {"Action":"output","Test":"TestPanic","Output":"panic: oops [recovered]\n"}
    {"Action":"output","Test":"TestPanic","Output":"\tpanic: oops\n"}
    {"Action":"output","Test":"TestPanic","Output":"\n"}
    {"Action":"output","Test":"TestPanic","Output":"goroutine 7 [running]:\n"}
    {"Action":"output","Test":"TestPanic","Output":"testing.tRunner.func1(0xc000092100)\n"}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 09 17:33:07 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  7. src/cmd/internal/test2json/testdata/panic.test

    --- FAIL: TestPanic (0.00s)
    panic: oops [recovered]
    	panic: oops
    
    goroutine 7 [running]:
    testing.tRunner.func1(0xc000092100)
    	/go/src/testing/testing.go:874 +0x3a3
    panic(0x1110ea0, 0x116aea0)
    	/go/src/runtime/panic.go:679 +0x1b2
    command-line-arguments.TestPanic(0xc000092100)
    	a_test.go:6 +0x39
    testing.tRunner(0xc000092100, 0x114f500)
    	go/src/testing/testing.go:909 +0xc9
    created by testing.(*T).Run
    	go/src/testing/testing.go:960 +0x350
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 30 20:46:44 UTC 2019
    - 479 bytes
    - Viewed (0)
  8. test/chan/select3.go

    		nilch <- 7
    	})
    	testBlock(always, func() {
    		<-nilch
    	})
    
    	// sending/receiving from a nil channel inside a select is never selected
    	testPanic(never, func() {
    		select {
    		case nilch <- 7:
    			unreachable()
    		default:
    		}
    	})
    	testPanic(never, func() {
    		select {
    		case <-nilch:
    			unreachable()
    		default:
    		}
    	})
    
    	// sending to an async channel with free buffer space never blocks
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Jul 08 02:10:12 UTC 2017
    - 4.1K bytes
    - Viewed (0)
  9. test/fixedbugs/issue56990.go

    }
    
    // Hack to run tests in a playground
    func matchString(a, b string) (bool, error) {
    	return a == b, nil
    }
    func main() {
    	testSuite := []testing.InternalTest{
    		{
    			Name: "TestPanic",
    			F:    TestPanic,
    		},
    	}
    	testing.Main(matchString, testSuite, nil, nil)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 30 17:46:51 UTC 2022
    - 2.3K bytes
    - Viewed (0)
  10. src/testing/panic_test.go

    )
    
    var testPanicTest = flag.String("test_panic_test", "", "TestPanic: indicates which test should panic")
    var testPanicParallel = flag.Bool("test_panic_parallel", false, "TestPanic: run subtests in parallel")
    var testPanicCleanup = flag.Bool("test_panic_cleanup", false, "TestPanic: indicates whether test should call Cleanup")
    var testPanicCleanupPanic = flag.String("test_panic_cleanup_panic", "", "TestPanic: indicate whether test should call Cleanup function that panics")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 27 16:49:24 UTC 2023
    - 7.4K bytes
    - Viewed (0)
Back to top