MCPcopy Create free account
hub / github.com/c-bata/go-prompt / TestDocument_TranslateRowColToIndex

Function TestDocument_TranslateRowColToIndex

document_test.go:1212–1227  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1210}
1211
1212func TestDocument_TranslateRowColToIndex(t *testing.T) {
1213 d := &Document{
1214 Text: "line 1\nline 2\nline 3\nline 4\n",
1215 cursorPosition: len("line 1\n" + "lin"),
1216 }
1217 ac := d.TranslateRowColToIndex(2, 3)
1218 ex := len("line 1\nline 2\nlin")
1219 if ac != ex {
1220 t.Errorf("Should be %#v, got %#v", ex, ac)
1221 }
1222 ac = d.TranslateRowColToIndex(0, 0)
1223 ex = 0
1224 if ac != ex {
1225 t.Errorf("Should be %#v, got %#v", ex, ac)
1226 }
1227}
1228
1229func TestDocument_OnLastLine(t *testing.T) {
1230 d := &Document{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…