mirror of
https://github.com/tucnak/telebot
synced 2024-11-15 06:13:01 +00:00
25 lines
539 B
Go
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)
|
||
|
}
|