(t *testing.T)
| 4492 | } |
| 4493 | |
| 4494 | func TestCommand_lookupFlag(t *testing.T) { |
| 4495 | pCmd := &Command{ |
| 4496 | Flags: []Flag{ |
| 4497 | &BoolFlag{ |
| 4498 | Name: "top-flag", |
| 4499 | Value: true, |
| 4500 | }, |
| 4501 | }, |
| 4502 | } |
| 4503 | cmd := &Command{ |
| 4504 | Flags: []Flag{ |
| 4505 | &BoolFlag{ |
| 4506 | Name: "local-flag", |
| 4507 | }, |
| 4508 | }, |
| 4509 | } |
| 4510 | _ = cmd.Run(context.Background(), []string{"--local-flag"}) |
| 4511 | pCmd.Commands = []*Command{cmd} |
| 4512 | _ = pCmd.Run(context.Background(), []string{"--top-flag"}) |
| 4513 | |
| 4514 | r := require.New(t) |
| 4515 | |
| 4516 | fs := cmd.lookupFlag("top-flag") |
| 4517 | r.Equal(pCmd.Flags[0], fs) |
| 4518 | |
| 4519 | fs = cmd.lookupFlag("local-flag") |
| 4520 | r.Equal(cmd.Flags[0], fs) |
| 4521 | r.Nil(cmd.lookupFlag("frob")) |
| 4522 | } |
| 4523 | |
| 4524 | func TestCommandAttributeAccessing(t *testing.T) { |
| 4525 | tdata := []struct { |
nothing calls this directly
no test coverage detected