You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
asar/encoder_test.go

30 lines
627 B
Go

package asar // import "b612.me/asar"
import (
"io/ioutil"
"strings"
"testing"
)
func TestEncodeInvalidName(t *testing.T) {
root := New(".", nil, 0, 0, FlagDir)
root.Children = append(
root.Children,
New(".", strings.NewReader("test"), 4, 0, FlagNone),
)
if _, err := root.EncodeTo(ioutil.Discard); err == nil {
t.Fatal("we should have had an error")
}
}
func TestEncodeUnpacked(t *testing.T) {
root := New(".", nil, 0, 0, FlagDir)
root.Children = append(
root.Children,
New("sample", nil, 0, 0, FlagUnpacked),
)
if _, err := root.EncodeTo(ioutil.Discard); err != nil {
t.Fatalf("err: %s", err)
}
}