telebot/file_test.go
Кобелев Андрей Андреевич 1b497f2b9b init
2023-02-01 12:08:20 +03:00

25 lines
539 B
Go

package telebot
import (
"io"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFile(t *testing.T) {
f := FromDisk("telebot.go")
g := FromURL("http://")
assert.True(t, f.OnDisk())
assert.True(t, (&File{FileID: "1"}).InCloud())
assert.Equal(t, File{FileLocal: "telebot.go"}, f)
assert.Equal(t, File{FileURL: "http://"}, g)
assert.Equal(t, File{FileReader: io.Reader(nil)}, FromReader(io.Reader(nil)))
g.stealRef(&f)
f.stealRef(&g)
assert.Equal(t, g.FileLocal, f.FileLocal)
assert.Equal(t, f.FileURL, g.FileURL)
}