vendor dependencies with dep

This commit is contained in:
dhax 2017-09-25 20:20:52 +02:00
parent 93d8310491
commit 1384296a47
2712 changed files with 965742 additions and 0 deletions

55
vendor/github.com/ssor/bom/bom_test.go generated vendored Normal file
View file

@ -0,0 +1,55 @@
package bom
import (
"bytes"
"io/ioutil"
"testing"
)
var (
test_cases = []struct {
src []byte
expected []byte
}{
{
[]byte{bom0, bom1, bom2}, []byte{},
},
{
[]byte{0x33, bom0, bom1, bom2}, []byte{0x33, bom0, bom1, bom2},
},
{
[]byte{bom0, bom1}, []byte{bom0, bom1},
},
{
[]byte{bom0, bom2}, []byte{bom0, bom2},
},
{
[]byte{bom0, bom1, bom2, 0x11}, []byte{0x11},
},
}
)
func TestNewReaderWithoutBom(t *testing.T) {
for index, test_case := range test_cases {
result, err := NewReaderWithoutBom(bytes.NewReader(test_case.src))
if err != nil {
t.Fatal(err)
}
bs, err := ioutil.ReadAll(result)
if err != nil {
t.Fatal(err)
}
if bytes.Compare(bs, test_case.expected) != 0 {
t.Fatalf("The %d th test_case failed", index)
}
}
}
func TestCleanBom(t *testing.T) {
for index, test_case := range test_cases {
result := CleanBom(test_case.src)
if bytes.Compare(result, test_case.expected) != 0 {
t.Fatalf("The %d th test_case failed", index)
}
}
}