fix: replace string(rune()) with strconv.Itoa in tests (bd-fmc)
Also updated CONFIG.md to clarify mass delete threshold requires >5 issues (bd-in6).
The string(rune('0'+i)) pattern produces incorrect characters when i >= 10.
Changed to strconv.Itoa(i) for reliable conversion.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -289,7 +290,7 @@ func TestDeepHierarchyCacheCorrectness(t *testing.T) {
|
||||
var issues []*types.Issue
|
||||
for i := 0; i < 4; i++ {
|
||||
issue := &types.Issue{
|
||||
Title: "Level " + string(rune('0'+i)),
|
||||
Title: "Level " + strconv.Itoa(i),
|
||||
Status: types.StatusOpen,
|
||||
Priority: 1,
|
||||
IssueType: types.TypeEpic,
|
||||
|
||||
@@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -143,7 +144,7 @@ func TestGetIssueCommentsOrdering(t *testing.T) {
|
||||
|
||||
// Add comments with identifiable ordering
|
||||
for i := 1; i <= 5; i++ {
|
||||
text := "Comment " + string(rune('0'+i))
|
||||
text := "Comment " + strconv.Itoa(i)
|
||||
_, err := store.AddIssueComment(ctx, issue.ID, "alice", text)
|
||||
if err != nil {
|
||||
t.Fatalf("AddIssueComment failed: %v", err)
|
||||
@@ -162,7 +163,7 @@ func TestGetIssueCommentsOrdering(t *testing.T) {
|
||||
}
|
||||
|
||||
for i := 0; i < len(comments); i++ {
|
||||
expectedText := "Comment " + string(rune('0'+i+1))
|
||||
expectedText := "Comment " + strconv.Itoa(i+1)
|
||||
if comments[i].Text != expectedText {
|
||||
t.Errorf("Comment %d: expected text %s, got %s", i, expectedText, comments[i].Text)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -112,9 +113,9 @@ func BenchmarkCheckEligibility(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func generateID(b testing.TB, prefix string, n int) string{
|
||||
func generateID(b testing.TB, prefix string, n int) string {
|
||||
b.Helper()
|
||||
return prefix + string(rune('0'+n/10)) + string(rune('0'+n%10))
|
||||
return prefix + strconv.Itoa(n)
|
||||
}
|
||||
|
||||
func setupBenchDB(tb testing.TB) (*SQLiteStorage, func()) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
@@ -415,7 +416,7 @@ func TestDetectCyclesLongCycle(t *testing.T) {
|
||||
issues := make([]*types.Issue, cycleLength)
|
||||
for i := 0; i < cycleLength; i++ {
|
||||
issues[i] = &types.Issue{
|
||||
Title: "Issue " + string(rune('0'+i)),
|
||||
Title: "Issue " + strconv.Itoa(i),
|
||||
Status: types.StatusOpen,
|
||||
Priority: 1,
|
||||
IssueType: types.TypeTask,
|
||||
|
||||
Reference in New Issue
Block a user