*: replace slice.Copy with bytes.Clone
And refactor some code a bit, don't use bytes.Clone where type-specific helpers may be used instead. Close #2907. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
b030c331b0
commit
8162e9033d
26 changed files with 68 additions and 89 deletions
|
@ -1,6 +1,7 @@
|
|||
package slice
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -30,7 +31,7 @@ var testCases = []struct {
|
|||
|
||||
func TestCopyReverse(t *testing.T) {
|
||||
for _, tc := range testCases {
|
||||
arg := Copy(tc.arr)
|
||||
arg := bytes.Clone(tc.arr)
|
||||
require.Equal(t, tc.arr, arg)
|
||||
|
||||
have := CopyReverse(arg)
|
||||
|
@ -52,7 +53,7 @@ func TestCopyReverse(t *testing.T) {
|
|||
|
||||
func TestClean(t *testing.T) {
|
||||
for _, tc := range testCases[1:] { // Empty one will be equal.
|
||||
cp := Copy(tc.arr)
|
||||
cp := bytes.Clone(tc.arr)
|
||||
Clean(cp)
|
||||
require.NotEqual(t, tc.arr, cp)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue