parent
30c963a5f0
commit
61a1c93f0f
89 changed files with 15859 additions and 2 deletions
28
server/libs/qtube/test_helper.go
Normal file
28
server/libs/qtube/test_helper.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package qtube
|
||||
|
||||
type StubFile struct {
|
||||
Content string
|
||||
Offset int64
|
||||
}
|
||||
|
||||
func (file *StubFile) Read(p []byte) (int, error) {
|
||||
copied := copy(p[:], []byte(file.Content)[:len(p)])
|
||||
return copied, nil
|
||||
}
|
||||
|
||||
func (file *StubFile) Seek(offset int64, whence int) (int64, error) {
|
||||
file.Offset = offset
|
||||
return offset, nil
|
||||
}
|
||||
|
||||
func (file *StubFile) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type stubFiler struct {
|
||||
file *StubFile
|
||||
}
|
||||
|
||||
func (filer *stubFiler) Open(filePath string) (ReadSeekCloser, error) {
|
||||
return filer.file, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue