MCPcopy Create free account
hub / github.com/astercloud/aster / TestTruncateString

Function TestTruncateString

pkg/agent/subagent_test.go:109–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestTruncateString(t *testing.T) {
110 tests := []struct {
111 input string
112 maxLen int
113 expected string
114 }{
115 {"hello", 10, "hello"},
116 {"hello world", 5, "he..."},
117 {"", 5, ""},
118 {"abc", 3, "abc"},
119 {"abcd", 3, "..."},
120 }
121
122 for _, tt := range tests {
123 result := truncateString(tt.input, tt.maxLen)
124 if result != tt.expected {
125 t.Errorf("truncateString(%q, %d) = %q, want %q", tt.input, tt.maxLen, result, tt.expected)
126 }
127 }
128}

Callers

nothing calls this directly

Calls 1

truncateStringFunction · 0.70

Tested by

no test coverage detected