Files
chaisql/internal/expr/function_test.go
Asdine El Hrychy f966172cee Introduce Value interface (#422)
This replaces the Value struct by an interface to allow us to override some
values behavior in the future.
It also introduces a new package types, which contains type definitions, comparison,
and arithmetics.
Concerning encoding, Genji now only uses on type of encoding for values. This simplifies
indexing logic as well as table access in general.
2021-07-21 22:05:44 +04:00

27 lines
557 B
Go

package expr_test
import (
"testing"
"github.com/genjidb/genji/internal/environment"
"github.com/genjidb/genji/types"
)
func TestPkExpr(t *testing.T) {
tests := []struct {
name string
env *environment.Environment
res types.Value
}{
{"empty env", &environment.Environment{}, nullLiteral},
{"env with doc", envWithDoc, nullLiteral},
{"env with doc and key", envWithDocAndKey, types.NewIntegerValue(1)},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
testExpr(t, "pk()", test.env, test.res, false)
})
}
}