1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-11-25 22:01:39 +02:00

Bug into object function KEEP (#121)

This commit is contained in:
3timeslazy
2018-10-14 22:22:41 +03:00
committed by Tim Voronov
parent 6df08a60cb
commit 0f3128e842
2 changed files with 28 additions and 14 deletions

View File

@@ -45,6 +45,24 @@ func TestKeep(t *testing.T) {
So(err, ShouldBeError)
So(obj, ShouldEqual, values.None)
})
Convey("Result object is independent of the source object", t, func() {
arr := values.NewArrayWith(values.Int(0))
obj := values.NewObjectWith(
values.NewObjectProperty("a", arr),
)
resultObj := values.NewObjectWith(
values.NewObjectProperty("a", values.NewArrayWith(values.Int(0))),
)
afterKeep, err := objects.Keep(context.Background(), obj, values.NewString("a"))
So(err, ShouldBeNil)
arr.Push(values.NewInt(1))
So(afterKeep.Compare(resultObj), ShouldEqual, 0)
})
}
func TestKeepStrings(t *testing.T) {