(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestRemoveCmd_CommandStructure(t *testing.T) { |
| 20 | // Cleanup. |
| 21 | dirs.RemoveAllForTest() |
| 22 | |
| 23 | // Test command creation |
| 24 | remove := &removeCmd{} |
| 25 | celer := &configs.Celer{} |
| 26 | |
| 27 | cmd := remove.Command(celer) |
| 28 | if cmd.Use != "remove" { |
| 29 | t.Errorf("Expected Use to be 'remove', got %s", cmd.Use) |
| 30 | } |
| 31 | |
| 32 | if cmd.Short == "" { |
| 33 | t.Error("Short description should not be empty") |
| 34 | } |
| 35 | |
| 36 | if cmd.Long == "" { |
| 37 | t.Error("Long description should not be empty") |
| 38 | } |
| 39 | |
| 40 | // Test flags. |
| 41 | tests := []struct { |
| 42 | flagName string |
| 43 | shorthand string |
| 44 | defaultValue string |
| 45 | }{ |
| 46 | {"build-cache", "c", "false"}, |
| 47 | {"recursive", "r", "false"}, |
| 48 | {"purge", "p", "false"}, |
| 49 | {"dev", "d", "false"}, |
| 50 | } |
| 51 | |
| 52 | for _, test := range tests { |
| 53 | t.Run(test.flagName, func(t *testing.T) { |
| 54 | flag := cmd.Flags().Lookup(test.flagName) |
| 55 | if flag == nil { |
| 56 | t.Errorf("Flag --%s should be defined", test.flagName) |
| 57 | return |
| 58 | } |
| 59 | |
| 60 | if flag.Shorthand != test.shorthand { |
| 61 | t.Errorf("Expected shorthand %s, got %s", test.shorthand, flag.Shorthand) |
| 62 | } |
| 63 | |
| 64 | if flag.DefValue != test.defaultValue { |
| 65 | t.Errorf("Expected default value %s, got %s", test.defaultValue, flag.DefValue) |
| 66 | } |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | // Test minimum args requirement |
| 71 | if cmd.Args == nil { |
| 72 | t.Error("Args validation should be set") |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func TestRemoveCmd_Completion(t *testing.T) { |
nothing calls this directly
no test coverage detected