fix(tests): update ResultTruncation_Unicode test to use valid CJK character

This commit is contained in:
SHINE-six 2026-03-17 12:49:32 +08:00
parent c908b84962
commit 4f3b7c6d3f

View file

@ -236,8 +236,9 @@ func TestSpawnStatusTool_ResultTruncation_Unicode(t *testing.T) {
provider := &MockLLMProvider{} provider := &MockLLMProvider{}
manager := NewSubagentManager(provider, "test-model", "/tmp/test") manager := NewSubagentManager(provider, "test-model", "/tmp/test")
// Each "字" is 3 bytes; 400 runes = 1200 bytes — well over the 300-rune limit. // Each CJK rune is 3 bytes; 400 runes = 1200 bytes — well over the 300-rune limit.
longResult := strings.Repeat("字", 400) cjkChar := string(rune(0x5b57))
longResult := strings.Repeat(cjkChar, 400)
manager.mu.Lock() manager.mu.Lock()
manager.tasks["subagent-1"] = &SubagentTask{ manager.tasks["subagent-1"] = &SubagentTask{
ID: "subagent-1", ID: "subagent-1",
@ -257,7 +258,7 @@ func TestSpawnStatusTool_ResultTruncation_Unicode(t *testing.T) {
t.Errorf("Expected truncation indicator in output") t.Errorf("Expected truncation indicator in output")
} }
// The truncated result must be valid UTF-8 (no split rune boundaries). // The truncated result must be valid UTF-8 (no split rune boundaries).
if !strings.Contains(result.ForLLM, "字") { if !strings.Contains(result.ForLLM, cjkChar) {
t.Errorf("Expected CJK runes to appear intact in output") t.Errorf("Expected CJK runes to appear intact in output")
} }
} }