zrepl/pruning/keep_helpers_test.go

24 lines
365 B
Go
Raw Normal View History

package pruning
import (
"testing"
2019-03-22 19:41:12 +01:00
"github.com/stretchr/testify/assert"
)
func TestShallowCopySnapList(t *testing.T) {
l1 := []Snapshot{
stubSnap{name: "foo"},
stubSnap{name: "bar"},
}
l2 := shallowCopySnapList(l1)
assert.Equal(t, l1, l2)
l1[0] = stubSnap{name: "baz"}
assert.Equal(t, "baz", l1[0].Name())
assert.Equal(t, "foo", l2[0].Name())
}