forked from TrueCloudLab/frostfs-s3-gw
Simplify OffsetWriter
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
parent
8168181658
commit
8ff289ea4f
2 changed files with 11 additions and 21 deletions
|
@ -12,7 +12,7 @@ type offsetWriter struct {
|
|||
length int64
|
||||
}
|
||||
|
||||
func newWriter(w io.Writer, offset, length int64) io.Writer {
|
||||
func newWriter(w io.Writer, offset, length int64) *offsetWriter {
|
||||
return &offsetWriter{
|
||||
Writer: w,
|
||||
offset: offset,
|
||||
|
|
|
@ -33,10 +33,8 @@ func TestOffsetWriter(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
wo := wt.(*offsetWriter)
|
||||
|
||||
require.Equal(t, o, wo.skipped)
|
||||
require.Equal(t, l, wo.written)
|
||||
require.Equal(t, o, wt.skipped)
|
||||
require.Equal(t, l, wt.written)
|
||||
require.Equal(t, b[o:o+l], w.Bytes())
|
||||
})
|
||||
|
||||
|
@ -51,10 +49,8 @@ func TestOffsetWriter(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
wo := wt.(*offsetWriter)
|
||||
|
||||
require.Equal(t, o, wo.skipped)
|
||||
require.Equal(t, l, wo.written)
|
||||
require.Equal(t, o, wt.skipped)
|
||||
require.Equal(t, l, wt.written)
|
||||
require.Equal(t, b[o:o+l], w.Bytes())
|
||||
})
|
||||
|
||||
|
@ -69,10 +65,8 @@ func TestOffsetWriter(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
wo := wt.(*offsetWriter)
|
||||
|
||||
require.Equal(t, o, wo.skipped)
|
||||
require.Equal(t, l, wo.written)
|
||||
require.Equal(t, o, wt.skipped)
|
||||
require.Equal(t, l, wt.written)
|
||||
require.Equal(t, b[o:o+l], w.Bytes())
|
||||
})
|
||||
|
||||
|
@ -87,10 +81,8 @@ func TestOffsetWriter(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
wo := wt.(*offsetWriter)
|
||||
|
||||
require.Equal(t, o, wo.skipped)
|
||||
require.Equal(t, s, wo.written)
|
||||
require.Equal(t, o, wt.skipped)
|
||||
require.Equal(t, s, wt.written)
|
||||
require.Equal(t, b, w.Bytes())
|
||||
})
|
||||
|
||||
|
@ -105,10 +97,8 @@ func TestOffsetWriter(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
wo := wt.(*offsetWriter)
|
||||
|
||||
require.Equal(t, o, wo.skipped)
|
||||
require.Equal(t, s, wo.written)
|
||||
require.Equal(t, o, wt.skipped)
|
||||
require.Equal(t, s, wt.written)
|
||||
require.Equal(t, b, w.Bytes())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue