1
0
Fork 0
mirror of https://github.com/Luzifer/sii.git synced 2024-12-30 04:11:15 +00:00
sii/t3nk/3nk_test.go

32 lines
566 B
Go
Raw Normal View History

package t3nk
import (
"io/ioutil"
"strings"
"testing"
)
func TestEncodeToDecode(t *testing.T) {
expect := "Ohai!"
f := strings.NewReader(expect)
r, err := Encode(f)
if err != nil {
t.Fatalf("Unable to encode test string: %s", err)
}
dr, err := Decode(r)
if err != nil {
t.Fatalf("Unable to decode test string: %s", err)
}
raw, err := ioutil.ReadAll(dr)
if err != nil {
t.Fatalf("Unable to read decoded test string: %s", err)
}
if s := string(raw); s != expect {
t.Errorf("Did not receive expected string: exp=%q got=%q", expect, s)
}
}