Beispiel #1
0
func initTestLog(t *testing.T, entries []testEntry) *log {
	l := newLog()
	for _, e := range entries {
		r := runes.StringReader(e.str)
		if err := l.append(e.seq, e.at, r); err != nil {
			t.Fatalf("l.append(%v, %v, %q)=%v", e.seq, e.at, e.str, err)
		}
	}
	return l
}
Beispiel #2
0
func (e change) do(ed *Editor, _ io.Writer) (addr, error) {
	switch e.op {
	case 'a':
		e.a = e.a.Plus(Rune(0))
	case 'i':
		e.a = e.a.Minus(Rune(0))
	}
	at, err := e.a.where(ed)
	if err != nil {
		return addr{}, err
	}
	return at, pend(ed, at, runes.StringReader(e.str))
}