@@ -2,6 +2,7 @@ package registry
22
33import (
44 "runtime"
5+ "strings"
56 "testing"
67)
78
@@ -219,48 +220,33 @@ func TestClaudePackageNameConsistency(t *testing.T) {
219220 continue
220221 }
221222 // Check if command contains the expected package name
222- if ! containsPackage (cmd , expectedPackage ) {
223+ if ! strings . Contains (cmd , expectedPackage ) {
223224 t .Errorf ("Install command for %s doesn't contain expected package '%s': %s" , os , expectedPackage , cmd )
224225 }
225226 // Ensure it doesn't contain the wrong package name
226227 wrongPackage := "@anthropic-ai/claude-cli"
227- if containsPackage (cmd , wrongPackage ) {
228+ if strings . Contains (cmd , wrongPackage ) {
228229 t .Errorf ("Install command for %s contains incorrect package '%s': %s" , os , wrongPackage , cmd )
229230 }
230231 }
231232
232233 // Verify all uninstall commands use the correct package
233234 for os , cmd := range agent .Uninstall {
234- if cmd == "" || cmd [:3 ] == "See" { // Skip manual instructions
235+ if cmd == "" || ( len ( cmd ) >= 3 && cmd [:3 ] == "See" ) { // Skip manual instructions
235236 continue
236237 }
237- if ! containsPackage (cmd , expectedPackage ) {
238+ if ! strings . Contains (cmd , expectedPackage ) {
238239 t .Errorf ("Uninstall command for %s doesn't contain expected package '%s': %s" , os , expectedPackage , cmd )
239240 }
240241 }
241242
242243 // Verify all upgrade commands use the correct package
243244 for os , cmd := range agent .Upgrade {
244- if cmd == "" || cmd [:3 ] == "See" { // Skip manual instructions
245+ if cmd == "" || ( len ( cmd ) >= 3 && cmd [:3 ] == "See" ) { // Skip manual instructions
245246 continue
246247 }
247- if ! containsPackage (cmd , expectedPackage ) {
248+ if ! strings . Contains (cmd , expectedPackage ) {
248249 t .Errorf ("Upgrade command for %s doesn't contain expected package '%s': %s" , os , expectedPackage , cmd )
249250 }
250251 }
251252}
252-
253- // containsPackage checks if a command string contains the given package name
254- func containsPackage (cmd , pkg string ) bool {
255- // Simple string contains check
256- return len (cmd ) >= len (pkg ) && findSubstring (cmd , pkg )
257- }
258-
259- func findSubstring (s , substr string ) bool {
260- for i := 0 ; i <= len (s )- len (substr ); i ++ {
261- if s [i :i + len (substr )] == substr {
262- return true
263- }
264- }
265- return false
266- }
0 commit comments