func printSurf(t *testing.T, surf Surface, tst viewtest, b *util.Buffer) { t.Log("") tabrep := strings.Repeat("\\t", tst.tabw) tabstr := "\\t" + strings.Repeat("--", tst.tabw-1) for y := 0; y < tst.h; y++ { got := "" expect := "" pretxt := " " midtxt := " " if y == 0 { pretxt = "expected" midtxt = "got" } for x := 0; x < tst.w; x++ { if r := surf.Rune(x, y); r == '\t' { got += "\\t" } else if r == '\n' { got += "\\n" } else { got += string(r) + " " } l, ch := tst.expectl[y][x], tst.expectch[y][x] if l == -1 || ch == -1 { expect += " " } else if r := b.Rune(l, ch); r == '\t' { expect += "\\t" } else if r == '\n' { expect += "\\n" } else { expect += string(r) + " " } } expect = strings.Replace(expect, tabrep, tabstr, -1) got = strings.Replace(got, tabrep, tabstr, -1) t.Logf("\t%v |%v| %v |%v|", pretxt, expect, midtxt, got) } t.Log("") }