Skip to content

Commit 73f50d6

Browse files
Copilotgh-aw-bot
andauthored
Improve test quality: migrate resolve_test.go to testify
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
1 parent 88dab22 commit 73f50d6

2 files changed

Lines changed: 90 additions & 251 deletions

File tree

pkg/workflow/helpers_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//go:build !integration
2+
3+
package workflow
4+
5+
// contains checks if a string contains a substring.
6+
// Deprecated: prefer strings.Contains or assert.Contains in new tests.
7+
func contains(s, substr string) bool {
8+
return len(s) >= len(substr) && (s == substr || len(substr) == 0 ||
9+
(len(s) > len(substr) && s[len(s)-len(substr):] == substr) ||
10+
(len(s) > len(substr) && s[:len(substr)] == substr) ||
11+
(len(s) > len(substr) && findSubstring(s, substr)))
12+
}
13+
14+
func findSubstring(s, substr string) bool {
15+
for i := 0; i <= len(s)-len(substr); i++ {
16+
if s[i:i+len(substr)] == substr {
17+
return true
18+
}
19+
}
20+
return false
21+
}

0 commit comments

Comments
 (0)