| 1 | package cliscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.22 bytes/" |
| 5 | "contextscip-go gomod github.com/golang/go/src go1.22 context/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.22 os/" |
| 7 | "testingscip-go gomod github.com/golang/go/src go1.22 testing/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.22 time/" |
| 9 | |
| 10 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 11 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 12 | ) |
| 13 | |
| 14 | func expectFileContentscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/expectFileContent().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#, file, got string) { |
| 15 | data, err := osscip-go gomod github.com/golang/go/src go1.22 os/.ReadFilescip-go gomod github.com/golang/go/src go1.22 os/ReadFile().(file) |
| 16 | // Ignore windows line endings |
| 17 | data = bytesscip-go gomod github.com/golang/go/src go1.22 bytes/.ReplaceAllscip-go gomod github.com/golang/go/src go1.22 bytes/ReplaceAll().(data, []byte("\r\n"), []byte("\n")) |
| 18 | |
| 19 | r := requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Newscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/New().(t) |
| 20 | r.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#NoError().(err) |
| 21 | r.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/Assertions#Equal().(got, string(data)) |
| 22 | } |
| 23 | |
| 24 | func buildTestContextscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/buildTestContext().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) contextscip-go gomod github.com/golang/go/src go1.22 context/.Contextscip-go gomod github.com/golang/go/src go1.22 context/Context# { |
| 25 | ctx, cancel := contextscip-go gomod github.com/golang/go/src go1.22 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.22 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.22 context/.Backgroundscip-go gomod github.com/golang/go/src go1.22 context/Background().(), 100*timescip-go gomod github.com/golang/go/src go1.22 time/.Millisecondscip-go gomod github.com/golang/go/src go1.22 time/Millisecond.) |
| 26 | t.Cleanupscip-go gomod github.com/golang/go/src go1.22 testing/common#Cleanup().(cancel) |
| 27 | |
| 28 | return ctx |
| 29 | } |
| 30 | |
| 31 | func TestTracingscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/TestTracing().(t *testingscip-go gomod github.com/golang/go/src go1.22 testing/.Tscip-go gomod github.com/golang/go/src go1.22 testing/T#) { |
| 32 | olderr := osscip-go gomod github.com/golang/go/src go1.22 os/.Stderrscip-go gomod github.com/golang/go/src go1.22 os/Stderr. |
| 33 | oldtracing := isTracingOnscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/isTracingOn. |
| 34 | defer func() { |
| 35 | osscip-go gomod github.com/golang/go/src go1.22 os/.Stderrscip-go gomod github.com/golang/go/src go1.22 os/Stderr. = olderr |
| 36 | isTracingOnscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/isTracingOn. = oldtracing |
| 37 | }() |
| 38 | |
| 39 | file, err := osscip-go gomod github.com/golang/go/src go1.22 os/.CreateTempscip-go gomod github.com/golang/go/src go1.22 os/CreateTemp().(osscip-go gomod github.com/golang/go/src go1.22 os/.TempDirscip-go gomod github.com/golang/go/src go1.22 os/TempDir().(), "cli*") |
| 40 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 41 | osscip-go gomod github.com/golang/go/src go1.22 os/.Stderrscip-go gomod github.com/golang/go/src go1.22 os/Stderr. = file |
| 42 | |
| 43 | // Note we can't really set the env since the isTracingOn |
| 44 | // is read at module startup so any changes mid code |
| 45 | // won't take effect |
| 46 | isTracingOnscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/isTracingOn. = false |
| 47 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("something") |
| 48 | |
| 49 | isTracingOnscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/isTracingOn. = true |
| 50 | tracefscip-go gomod github.com/urfave/cli/v3 . `github.com/urfave/cli/v3`/tracef().("foothing") |
| 51 | |
| 52 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, file.Closescip-go gomod github.com/golang/go/src go1.22 os/File#Close().()) |
| 53 | |
| 54 | b, err := osscip-go gomod github.com/golang/go/src go1.22 os/.ReadFilescip-go gomod github.com/golang/go/src go1.22 os/ReadFile().(file.Namescip-go gomod github.com/golang/go/src go1.22 os/File#Name().()) |
| 55 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err) |
| 56 | |
| 57 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Containsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Contains().(t, string(b), "foothing") |
| 58 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotContainsscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotContains().(t, string(b), "something") |
| 59 | } |