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

Added support for params as segments in member expression path

This commit is contained in:
Tim Voronov
2019-09-07 01:57:33 -04:00
parent 0a2fd478cd
commit 04eea23e52
5 changed files with 411 additions and 366 deletions

View File

@@ -95,4 +95,22 @@ func TestParam(t *testing.T) {
So(string(out), ShouldEqual, `"bar"`)
})
Convey("Should be possible to use in member expression as segments", t, func() {
prog := compiler.New().
MustCompile(`
LET doc = { foo: { bar: "baz" } }
RETURN doc.@attr.@subattr
`)
out := prog.MustRun(
context.Background(),
runtime.WithParam("attr", "foo"),
runtime.WithParam("subattr", "bar"),
)
So(string(out), ShouldEqual, `"baz"`)
})
}