mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-04-23 11:11:51 -07:00
feat: add file helper
This commit is contained in:
parent
ef10d7d7ec
commit
37dd5f1d27
3 changed files with 42 additions and 2 deletions
21
file_test.go
Normal file
21
file_test.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package bimg
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRead(t *testing.T) {
|
||||
buf, err := Read("fixtures/test.jpg")
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Cannot read the image: %#v", err)
|
||||
}
|
||||
|
||||
if len(buf) == 0 {
|
||||
t.Fatal("Empty buffer")
|
||||
}
|
||||
|
||||
if DetermineImageType(buf) != JPEG {
|
||||
t.Fatal("Image is not jpeg")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue