mirror of
https://github.com/chaisql/chai.git
synced 2025-10-28 09:51:28 +08:00
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.
27 lines
557 B
Go
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)
|
|
})
|
|
}
|
|
}
|