update: improve coverage
This commit is contained in:
parent
fdf3057743
commit
d0ec38c405
|
@ -7,6 +7,7 @@ import (
|
|||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
"errors"
|
||||
)
|
||||
|
||||
func TestNewCaptcha(t *testing.T) {
|
||||
|
@ -62,6 +63,18 @@ func TestCovNilFontError(t *testing.T) {
|
|||
ttfFont = temp
|
||||
}
|
||||
|
||||
type errReader struct {}
|
||||
func (errReader) Read(_ []byte) (int, error) {
|
||||
return 0, errors.New("")
|
||||
}
|
||||
|
||||
func TestCovReaderErr(t *testing.T) {
|
||||
err := LoadFontFromReader(errReader{})
|
||||
if err == nil {
|
||||
t.Fatal("Expect to get io.Reader error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadFont(t *testing.T) {
|
||||
err := LoadFont(goregular.TTF)
|
||||
if err != nil {
|
||||
|
|
Reference in New Issue