chore: remove old test file
This commit is contained in:
parent
0d1f65daac
commit
cd0d3b8892
|
@ -1,38 +0,0 @@
|
||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Testing functions that call os.Exit
|
|
||||||
// https://stackoverflow.com/questions/26225513/how-to-test-os-exit-scenarios-in-go
|
|
||||||
// https://talks.golang.org/2014/testing.slide#23
|
|
||||||
|
|
||||||
var testapp = &cli.App{
|
|
||||||
Name: "abra",
|
|
||||||
Usage: `The Co-op Cloud command-line utility belt 🎩🐇`,
|
|
||||||
}
|
|
||||||
|
|
||||||
// not testing output as that changes. just if it exits with code 1
|
|
||||||
// does not work because of some weird errors on cli's part. Its a hard lib to test effectively.
|
|
||||||
// func TestShowSubcommandHelpAndError(t *testing.T) {
|
|
||||||
// if os.Getenv("HelpAndError") == "1" {
|
|
||||||
// ShowSubcommandHelpAndError(cli.NewContext(testapp, nil, nil), errors.New("Test error"))
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// cmd := exec.Command(os.Args[0], "-test.run=TestShowSubcommandHelpAndError")
|
|
||||||
// cmd.Env = append(os.Environ(), "HelpAndError=1")
|
|
||||||
// var out bytes.Buffer
|
|
||||||
// cmd.Stderr = &out
|
|
||||||
// err := cmd.Run()
|
|
||||||
// println(out.String())
|
|
||||||
// if !strings.Contains(out.String(), "Test error") {
|
|
||||||
|
|
||||||
// t.Fatalf("expected command to show the error causing the exit, did not get correct stdout output")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if e, ok := err.(*exec.ExitError); ok && !e.Success() {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// t.Fatalf("process ran with err %v, want exit status 1", err)
|
|
||||||
// }
|
|
Loading…
Reference in New Issue