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:
@@ -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"`)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user