(t *testing.T)
| 125 | } |
| 126 | |
| 127 | func TestCleanCmd_ValidateTargets(t *testing.T) { |
| 128 | // Cleanup. |
| 129 | dirs.RemoveAllForTest() |
| 130 | |
| 131 | tests := []struct { |
| 132 | name string |
| 133 | targets []string |
| 134 | expectError bool |
| 135 | }{ |
| 136 | { |
| 137 | name: "no_targets", |
| 138 | targets: []string{}, |
| 139 | expectError: true, |
| 140 | }, |
| 141 | { |
| 142 | name: "single_package", |
| 143 | targets: []string{"x264@stable"}, |
| 144 | expectError: false, |
| 145 | }, |
| 146 | { |
| 147 | name: "multiple_packages", |
| 148 | targets: []string{"x264@stable", "ffmpeg@3.4.13"}, |
| 149 | expectError: false, |
| 150 | }, |
| 151 | { |
| 152 | name: "project_target", |
| 153 | targets: []string{"my-project"}, |
| 154 | expectError: false, |
| 155 | }, |
| 156 | { |
| 157 | name: "mixed_targets", |
| 158 | targets: []string{"x264@stable", "my-project"}, |
| 159 | expectError: false, |
| 160 | }, |
| 161 | } |
| 162 | |
| 163 | for _, test := range tests { |
| 164 | t.Run(test.name, func(t *testing.T) { |
| 165 | cleanCmd := cleanCmd{} |
| 166 | err := cleanCmd.validateTargets(test.targets) |
| 167 | |
| 168 | if test.expectError && err == nil { |
| 169 | t.Error("Expected error but got none") |
| 170 | } else if !test.expectError && err != nil { |
| 171 | t.Errorf("Expected no error but got: %v", err) |
| 172 | } |
| 173 | }) |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | func TestCleanCmd_Completion(t *testing.T) { |
| 178 | // Cleanup. |
nothing calls this directly
no test coverage detected