MCPcopy Create free account
hub / github.com/anchordotdev/cli / setupCleanup

Function setupCleanup

cli_test.go:23–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func setupCleanup(t *testing.T) {
24 t.Helper()
25
26 cliOS, cliArch := cli.Version.Os, cli.Version.Arch
27 cli.Version.Os, cli.Version.Arch = "goos", "goarch"
28
29 cliExecutable := cli.Executable
30 switch runtime.GOOS {
31 case "darwin", "linux":
32 cli.Executable = "/tmp/go-build0123456789/b001/exe/anchor"
33 case "windows":
34 cli.Executable = `C:\Users\username\AppData\Local\Temp\go-build0123456789/b001/exe/anchor.exe`
35 }
36
37 t.Cleanup(func() {
38 cli.Version.Os, cli.Version.Arch = cliOS, cliArch
39 cli.Executable = cliExecutable
40 })
41}
42
43var CmdError = cli.NewCmd[ErrorCommand](nil, "error", func(cmd *cobra.Command) {})
44

Callers 2

TestErrorFunction · 0.85
TestPanicFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected