From bf9b51caf44ac2e75f44ab6e67684a30d7074001 Mon Sep 17 00:00:00 2001 From: Chris Nobody Date: Wed, 31 Mar 2021 19:16:12 +0300 Subject: [PATCH] gocomplete: do not suppress test failures Ensure that the components of the `testing` package that rely on calling `os.Exit` remain functional and any test failures are actually reported back after the `monkey.Patch` in the `gocomplete.Example` test. Fix #135 --- gocomplete/tests_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gocomplete/tests_test.go b/gocomplete/tests_test.go index 750147a..a1238a4 100644 --- a/gocomplete/tests_test.go +++ b/gocomplete/tests_test.go @@ -43,7 +43,8 @@ func TestPredictions(t *testing.T) { func BenchmarkFake(b *testing.B) {} func Example() { - monkey.Patch(os.Exit, func(int) {}) + p := monkey.Patch(os.Exit, func(int) {}) + defer p.Unpatch() os.Setenv("COMP_LINE", "go ru") os.Setenv("COMP_POINT", "5") main()