Beispiel #1
0
func expect(t *testing.T, f memfile.File, s string) {
	f.Seek(0, 0)
	b, _ := ioutil.ReadAll(f)
	if string(b) != s {
		t.Errorf("'%v'!='%v'", string(b), s)
		t.FailNow()
	}
}
Beispiel #2
0
// Return a new File that commands may be run on, with the dot defaulting
// to the entire file. Note that if the backing memfile is changed the dot
// will no longer be up to date!
func New(f memfile.File) (*File, error) {
	if f != nil {
		return &File{f: f, dot: Adr{Start: 0, End: f.Length()}}, nil
	}
	return nil, errors.New("Need a backing file")
}