gotest.tools/gotestsum@v1.11.0/testjson/doc.go (about)

     1  /*
     2  Package testjson scans test2json output and builds up a summary of the events.
     3  Events are passed to a formatter for output.
     4  
     5  # Example
     6  
     7  This example reads the test2json output from os.Stdin. It sends every
     8  event to the handler, builds an Execution from the output, then it
     9  prints the number of tests run.
    10  
    11  	exec, err := testjson.ScanTestOutput(testjson.ScanConfig{
    12  	    // Stdout is a reader that provides the test2json output stream.
    13  	    Stdout: os.Stdin,
    14  	    // Handler receives TestEvents and error lines.
    15  	    Handler: eventHandler,
    16  	})
    17  	if err != nil {
    18  	    return fmt.Errorf("failed to scan testjson: %w", err)
    19  	}
    20  	fmt.Println("Ran %d tests", exec.Total())
    21  */
    22  package testjson // import "gotest.tools/gotestsum/testjson"