MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestTruncateText_Long

Function TestTruncateText_Long

utils_test.go:114–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

112}
113
114func TestTruncateText_Long(t *testing.T) {
115 text := "This is a very long text that needs to be truncated"
116 result := truncateText(text, 20)
117 expected := "This is a very lo..."
118 if result != expected {
119 t.Errorf("Long text should be truncated: got '%s', want '%s'", result, expected)
120 }
121 // Check that result doesn't exceed maxWidth
122 if len([]rune(result)) > 20 {
123 t.Errorf("Truncated text exceeds maxWidth: got length %d, want 20", len([]rune(result)))
124 }
125}
126
127func TestTruncateText_ExactLength(t *testing.T) {
128 text := "Exactly20Characters!"

Callers

nothing calls this directly

Calls 1

truncateTextFunction · 0.85

Tested by

no test coverage detected