1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-09-27 12:54:02 +00:00
go-mtree/vis_test.go

36 lines
644 B
Go
Raw Normal View History

package mtree
import "testing"
func TestVis(t *testing.T) {
testset := []struct {
Src, Dest string
}{
{"[", "\\133"},
{" ", "\\040"},
{" ", "\\011"},
}
for i := range testset {
got, err := Vis(testset[i].Src)
if err != nil {
t.Errorf("working with %q: %s", testset[i].Src, err)
continue
}
if got != testset[i].Dest {
t.Errorf("expected %#v; got %#v", testset[i].Dest, got)
continue
}
got, err = Unvis(got)
if err != nil {
t.Errorf("working with %q: %s", testset[i].Src, err)
continue
}
if got != testset[i].Src {
t.Errorf("expected %#v; got %#v", testset[i].Src, got)
continue
}
}
}