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

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

View as plain text