(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestFlagGetters(t *testing.T) { |
| 10 | t.Run("returns the name", func(t *testing.T) { |
| 11 | flag := Flag{Name: "Foo"} |
| 12 | want := "Foo" |
| 13 | got := flag.GetName() |
| 14 | |
| 15 | assert.Equal(t, want, got) |
| 16 | }) |
| 17 | |
| 18 | t.Run("returns the label", func(t *testing.T) { |
| 19 | flag := Flag{Name: "Foo"} |
| 20 | want := "Foo:" |
| 21 | got := flag.GetLabel() |
| 22 | |
| 23 | assert.Equal(t, want, got) |
| 24 | }) |
| 25 | |
| 26 | t.Run("returns the help", func(t *testing.T) { |
| 27 | flag := Flag{Help: "Foo"} |
| 28 | want := "Foo" |
| 29 | got := flag.GetHelp() |
| 30 | |
| 31 | assert.Equal(t, want, got) |
| 32 | }) |
| 33 | |
| 34 | t.Run("returns that the flag is required", func(t *testing.T) { |
| 35 | flag := Flag{IsRequired: true} |
| 36 | want := true |
| 37 | got := flag.GetIsRequired() |
| 38 | |
| 39 | assert.Equal(t, want, got) |
| 40 | }) |
| 41 | |
| 42 | t.Run("returns that the flag is not required", func(t *testing.T) { |
| 43 | flag := Flag{IsRequired: false} |
| 44 | want := false |
| 45 | got := flag.GetIsRequired() |
| 46 | |
| 47 | assert.Equal(t, want, got) |
| 48 | }) |
| 49 | } |
nothing calls this directly
no test coverage detected