Skip to content

Commit 366b72a

Browse files
committed
added ReadAsUTF8(r io.Reader)
1 parent 89dc6f6 commit 366b72a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

encoding_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
package subtitles
22

33
import (
4+
"os"
45
"testing"
56

67
"github.com/stretchr/testify/assert"
78
)
89

910
func TestLooksLikeLatin1(t *testing.T) {
11+
1012
assert.Equal(t, true, looksLikeLatin1([]byte("hall\xe5")))
1113
assert.Equal(t, false, looksLikeLatin1([]byte("hallå")))
1214
}
15+
16+
func TestReadFileAsUTF8(t *testing.T) {
17+
18+
f, err := os.Open("README.md")
19+
assert.Equal(t, nil, err)
20+
21+
_, err = ReadAsUTF8(f)
22+
assert.Equal(t, nil, err)
23+
}

0 commit comments

Comments
 (0)