github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/edit/ui/render_test.go (about) 1 package ui 2 3 import "testing" 4 5 type dummyRenderer struct { 6 } 7 8 func (dummyRenderer) Render(b *Buffer) { 9 b.WriteString("xy", "1") 10 } 11 12 func TestRender(t *testing.T) { 13 b := Render(dummyRenderer{}, 10) 14 if b.Width != 10 { 15 t.Errorf("Rendered Buffer has Width %d, want %d", b.Width, 10) 16 } 17 if eq, _ := CompareCells(b.Lines[0], []Cell{{"x", 1, "1"}, {"y", 1, "1"}}); !eq { 18 t.Errorf("Rendered Buffer has unexpected content") 19 } 20 }