src/cmd/go/testdata/script/test_example_goexit.txt
raw| 1 | # For issue golang.org/issue/41084 |
| 2 | [short] skip |
| 3 | |
| 4 | ! go test -v examplegoexit |
| 5 | stdout '(?s)--- PASS.*--- FAIL.*' |
| 6 | stdout 'panic: test executed panic\(nil\) or runtime\.Goexit' |
| 7 | |
| 8 | -- go.mod -- |
| 9 | module examplegoexit |
| 10 | |
| 11 | go 1.16 |
| 12 | -- example_test.go -- |
| 13 | package main |
| 14 | |
| 15 | import ( |
| 16 | "fmt" |
| 17 | "runtime" |
| 18 | ) |
| 19 | |
| 20 | func Example_pass() { |
| 21 | fmt.Println("pass") |
| 22 | // Output: |
| 23 | // pass |
| 24 | } |
| 25 | |
| 26 | func Example_goexit() { |
| 27 | runtime.Goexit() |
| 28 | // Output: |
| 29 | } |