github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/util/ioutil/seek_test.go (about) 1 package ioutil 2 3 import ( 4 "strings" 5 "testing" 6 ) 7 8 func TestNewSeekingReaderAt(t *testing.T) { 9 reader := NewSeekingReaderAt(strings.NewReader("abc")) 10 defer reader.Close() 11 12 n, err := reader.Size() 13 if err != nil { 14 t.Fatal(err) 15 } 16 if n != 3 { 17 t.Errorf("got %d", n) 18 } 19 20 var buf [3]byte 21 r, err := reader.ReadAt(buf[:], 0) 22 if err != nil { 23 t.Fatal(err) 24 } 25 if r != 3 { 26 t.Errorf("got %d", r) 27 } 28 }