mirror of
https://github.com/x-motemen/ghq.git
synced 2026-09-10 07:26:27 -04:00
Address code review feedback: use strings.Contains and remove extra blank line
Co-authored-by: Songmu <177122+Songmu@users.noreply.github.com>
This commit is contained in:
parent
9515744ee5
commit
640fb3f223
|
|
@ -4,6 +4,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
|
@ -152,21 +153,8 @@ func TestMigrateEdgeCases(t *testing.T) {
|
|||
t.Error("should fail for unsupported VCS (CVS)")
|
||||
}
|
||||
// Check that the error message mentions unsupported VCS
|
||||
if e != nil && !contains(e.Error(), "not supported") {
|
||||
if e != nil && !strings.Contains(e.Error(), "not supported") {
|
||||
t.Errorf("expected 'not supported' error, got: %v", e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func contains(s, substr string) bool {
|
||||
return len(s) >= len(substr) && (s == substr || len(s) > len(substr) && containsHelper(s, substr))
|
||||
}
|
||||
|
||||
func containsHelper(s, substr string) bool {
|
||||
for i := 0; i <= len(s)-len(substr); i++ {
|
||||
if s[i:i+len(substr)] == substr {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue