Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.2 KB

README.md

File metadata and controls

32 lines (23 loc) · 1.2 KB

texit

Report Build Status Coverage Status GoDoc GitHub license Release

Yes, you can use os.Exit() in Go tests.

Inspired by https://talks.golang.org/2014/testing.slide#23

Example in a testing function

import (
	"os"

	"github.com/corebreaker/texit"
)

func TestWithExitDirectCall(t *testing.T) {
	stdout, stderr, status, err := DoTestWithExit(func() {
		// Something to do

		os.Exit(0)
	})

	// …
}