selectors support for hash
Some checks failed
Build / build (push) Successful in 10m20s
Test / build (push) Failing after 16m7s

This commit is contained in:
Chuck Smith
2024-03-21 16:39:31 -04:00
parent d3471af03d
commit 66d5453ecc
8 changed files with 98 additions and 2 deletions

View File

@@ -577,6 +577,36 @@ func TestHashLiterals(t *testing.T) {
}
}
func TestHashSelectorExpressions(t *testing.T) {
tests := []struct {
input string
expected interface{}
}{
{
`{"foo": 5}.foo`,
5,
},
{
`{"foo": 5}.bar`,
nil,
},
{
`{}.foo`,
nil,
},
}
for _, tt := range tests {
evaluated := testEval(tt.input)
integer, ok := tt.expected.(int)
if ok {
testIntegerObject(t, evaluated, int64(integer))
} else {
testNullObject(t, evaluated)
}
}
}
func TestHashIndexExpressions(t *testing.T) {
tests := []struct {
input string