mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-15 13:18:45 +00:00
36 lines
644 B
Go
36 lines
644 B
Go
|
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
|
||
|
}
|
||
|
}
|
||
|
}
|