Copy should return a new document, not interface{}
This commit is contained in:
parent
33391e0a28
commit
3f68f1318c
2 changed files with 3 additions and 3 deletions
|
@ -57,8 +57,8 @@ func (d *Doc) Data() interface{} {
|
|||
}
|
||||
|
||||
// Copy returns a duplicated copy of the internal data object.
|
||||
func (d *Doc) Copy() (i interface{}) {
|
||||
return deep.Copy(d.data)
|
||||
func (d *Doc) Copy() *Doc {
|
||||
return &Doc{data: deep.Copy(d.data)}
|
||||
}
|
||||
|
||||
// Encode encodes the data object to a byte slice.
|
||||
|
|
|
@ -1048,7 +1048,7 @@ func TestOperations(t *testing.T) {
|
|||
// ----------------------------------------------------------------------------------------------------
|
||||
|
||||
Convey("Can copy object", t, func() {
|
||||
So(doc.Copy(), ShouldResemble, doc.Data())
|
||||
So(doc.Copy().Data(), ShouldResemble, doc.Data())
|
||||
})
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue