@@ -11,7 +11,6 @@ import (
1111 "path"
1212 "path/filepath"
1313 "strings"
14- "testing"
1514)
1615
1716func symlinkFile (src string , dest string ) error {
@@ -145,42 +144,3 @@ func CopyDir(src, dest, baseDirName string) error {
145144
146145 return nil
147146}
148-
149- // TestExpectTFatal provides a wrapper for logic which should call
150- // (*testing.T).Fatal() or (*testing.T).Fatalf().
151- //
152- // Since we do not want the wrapping test to fail when an expected test error
153- // occurs, it is required that the testLogic passed in uses
154- // github.com/mitchellh/go-testing-interface.RuntimeT instead of the real **
155- // *testing.T.
156- //
157- // If Fatal() or Fatalf() is not called in the logic, the real (*testing.T).Fatal() will
158- // be called to fail the test.
159- func TestExpectTFatal (t * testing.T , testLogic func ()) {
160- t .Helper ()
161-
162- var recoverIface interface {}
163-
164- func () {
165- defer func () {
166- recoverIface = recover ()
167- }()
168-
169- testLogic ()
170- }()
171-
172- if recoverIface == nil {
173- t .Fatalf ("expected t.Fatal(), got none" )
174- }
175-
176- recoverStr , ok := recoverIface .(string )
177-
178- if ! ok {
179- t .Fatalf ("expected string from recover(), got: %v (%T)" , recoverIface , recoverIface )
180- }
181-
182- // this string is hardcoded in github.com/mitchellh/go-testing-interface
183- if ! strings .HasPrefix (recoverStr , "testing.T failed, see logs for output" ) {
184- t .Fatalf ("expected t.Fatal(), got: %s" , recoverStr )
185- }
186- }
0 commit comments