MCPcopy
hub / github.com/urfave/cli / TestActionFunc

Function TestActionFunc

scripts/build.go:239–269  ·  view source on GitHub ↗
(ctx context.Context, cmd *cli.Command)

Source from the content-addressed store, hash-verified

237}
238
239func TestActionFunc(ctx context.Context, cmd *cli.Command) error {
240 tags := cmd.String("tags")
241
242 for _, pkg := range cmd.StringSlice("packages") {
243 packageName := "github.com/urfave/cli/v3"
244
245 if pkg != "cli" {
246 packageName = fmt.Sprintf("github.com/urfave/cli/v3/%s", pkg)
247 }
248
249 args := []string{"test"}
250 if tags != "" {
251 args = append(args, []string{"-tags", tags}...)
252 }
253
254 args = append(args, []string{
255 "-v",
256 "-race",
257 "--coverprofile", pkg + ".coverprofile",
258 "--covermode", "atomic",
259 "--cover", packageName,
260 packageName,
261 }...)
262
263 if err := runCmd(ctx, "go", args...); err != nil {
264 return err
265 }
266 }
267
268 return testCleanup(cmd.StringSlice("packages"))
269}
270
271func testCleanup(packages []string) error {
272 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 4

runCmdFunction · 0.85
testCleanupFunction · 0.85
StringSliceMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected