(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestInitCmd_CommandStructure(t *testing.T) { |
| 16 | // Cleanup. |
| 17 | dirs.RemoveAllForTest() |
| 18 | |
| 19 | initCmd := initCmd{} |
| 20 | celer := configs.NewCeler() |
| 21 | cmd := initCmd.Command(celer) |
| 22 | |
| 23 | // Test command basic properties. |
| 24 | if cmd.Use != "init" { |
| 25 | t.Errorf("Expected Use to be 'init', got '%s'", cmd.Use) |
| 26 | } |
| 27 | |
| 28 | if cmd.Short == "" { |
| 29 | t.Error("Short description should not be empty") |
| 30 | } |
| 31 | |
| 32 | // Test flags. |
| 33 | urlFlag := cmd.Flags().Lookup("url") |
| 34 | if urlFlag == nil { |
| 35 | t.Error("--url flag should be defined") |
| 36 | } else { |
| 37 | if urlFlag.Shorthand != "u" { |
| 38 | t.Errorf("Expected url flag shorthand to be 'u', got '%s'", urlFlag.Shorthand) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | branchFlag := cmd.Flags().Lookup("branch") |
| 43 | if branchFlag == nil { |
| 44 | t.Error("--branch flag should be defined") |
| 45 | } else { |
| 46 | if branchFlag.Shorthand != "b" { |
| 47 | t.Errorf("Expected branch flag shorthand to be 'b', got '%s'", branchFlag.Shorthand) |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestInitCmd_Completion(t *testing.T) { |
| 53 | // Cleanup. |
nothing calls this directly
no test coverage detected