Description
internal/session/resume_test.go defines two custom helper functions (contains and containsSubstring) that reimplement strings.Contains from the standard library:
func contains(s, substr string) bool {
return len(s) >= len(substr) && (s == substr || len(s) > 0 && containsSubstring(s, substr))
}
func containsSubstring(s, sub string) bool {
for i := 0; i <= len(s)-len(sub); i++ {
if s[i:i+len(sub)] == sub {
return true
}
}
return false
}
These should be replaced with a single call to strings.Contains, which is functionally identical and far more readable.
Scope
- File:
internal/session/resume_test.go
- Functions to remove:
contains, containsSubstring
- Call site:
TestSessionFilePath_ValidID
Acceptance Criteria
Context
Discovered during code review of #590. The custom helpers are unnecessary since strings.Contains provides the same functionality. This is a straightforward cleanup.
Description
internal/session/resume_test.godefines two custom helper functions (containsandcontainsSubstring) that reimplementstrings.Containsfrom the standard library:These should be replaced with a single call to
strings.Contains, which is functionally identical and far more readable.Scope
internal/session/resume_test.gocontains,containsSubstringTestSessionFilePath_ValidIDAcceptance Criteria
containsandcontainsSubstringhelper functions"strings"to the import blockstrings.Contains(path, expectedSuffix)make test)make check)Context
Discovered during code review of #590. The custom helpers are unnecessary since
strings.Containsprovides the same functionality. This is a straightforward cleanup.