Text file src/cmd/go/testdata/script/test_example_goexit.txt

     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 ExamplePass() {
    21  	fmt.Println("pass")
    22  	// Output:
    23  	// pass
    24  }
    25  
    26  func ExampleGoexit() {
    27  	runtime.Goexit()
    28  	// Output:
    29  }
    30  

View as plain text