31 lines
719 B
Go
31 lines
719 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
|
||
|
package ext
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"strings"
|
||
|
_ "fmt"
|
||
|
_ "log"
|
||
|
"io"
|
||
|
)
|
||
|
|
||
|
func TestNewBasicReader(t *testing.T) {
|
||
|
testReader := strings.NewReader("some test data")
|
||
|
basicReader := NewReader(testReader)
|
||
|
assert.NotNil(t, basicReader)
|
||
|
_, ok := basicReader.(io.WriterTo)
|
||
|
assert.False(t, ok)
|
||
|
}
|
||
|
|
||
|
func TestNewBasicReadCloser(t *testing.T) {
|
||
|
testReader := strings.NewReader("some test data")
|
||
|
basicReader := NewReadCloser(io.NopCloser(testReader))
|
||
|
assert.NotNil(t, basicReader)
|
||
|
_, ok := basicReader.(io.WriterTo)
|
||
|
assert.False(t, ok)
|
||
|
_, hasCloser := basicReader.(io.Closer)
|
||
|
assert.True(t, hasCloser)
|
||
|
}
|