示例#1
0
文件: log_test.go 项目: chai2010/T
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
}
示例#2
0
文件: edit.go 项目: chai2010/T
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))
}