testutil

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayValue

func ArrayValue(a types.Array) expr.LiteralValue

ArrayValue creates a literal value of type Array.

func BlobValue

func BlobValue(v []byte) expr.LiteralValue

BlobValue creates a literal value of type Blob.

func BoolValue

func BoolValue(v bool) expr.LiteralValue

BoolValue creates a literal value of type Bool.

func CloneObject

func CloneObject(t testing.TB, d types.Object) *object.FieldBuffer

func DoubleValue

func DoubleValue(v float64) expr.LiteralValue

DoubleValue creates a literal value of type Double.

func Dump

func Dump(t testing.TB, v interface{})

Dump a json representation of v to os.Stdout.

func DumpPebble

func DumpPebble(t testing.TB, pdb *pebble.DB)

func Exec

func Exec(db *database.Database, tx *database.Transaction, q string, params ...environment.Param) error

func ExprList

func ExprList(t testing.TB, s string) expr.LiteralExprList

func ExprRunner

func ExprRunner(t *testing.T, testfile string)

func FunctionExpr

func FunctionExpr(t testing.TB, name string, args ...expr.Expr) expr.Expr

func Int64Ptr

func Int64Ptr(n int64) *int64

func IntegerValue

func IntegerValue(v int64) expr.LiteralValue

IntegerValue creates a literal value of type Integer.

func IteratorToJSONArray

func IteratorToJSONArray(w io.Writer, s database.RowIterator) error

IteratorToJSONArray encodes all the objects of an iterator to a JSON array.

func MakeArray

func MakeArray(t testing.TB, jsonArray string) types.Array

MakeArray creates an array from a json string.

func MakeArrayValue

func MakeArrayValue(t testing.TB, vs ...any) types.Value

func MakeObject

func MakeObject(t testing.TB, jsonDoc string) types.Object

MakeObject creates an object from a json string.

func MakeValue

func MakeValue(t testing.TB, v any) types.Value

MakeValue turns v into a types.Value.

func MakeValueBuffer

func MakeValueBuffer(t testing.TB, jsonArray string) *object.ValueBuffer

func MustExec

func MustExec(t *testing.T, db *database.Database, tx *database.Transaction, q string, params ...environment.Param)

func MustQuery

func MustQuery(t *testing.T, db *database.Database, tx *database.Transaction, q string, params ...environment.Param) *statement.Result

func NewEngine

func NewEngine(t testing.TB) *kv.Store

func NewKey

func NewKey(t testing.TB, values ...types.Value) *tree.Key

func NewTestDB

func NewTestDB(t testing.TB) *database.Database

func NewTestTree

func NewTestTree(t testing.TB, namespace tree.Namespace) *tree.Tree

func NewTestTx

func NewTestTx(t testing.TB) (*database.Database, *database.Transaction, func())

func NullValue

func NullValue() expr.LiteralValue

NullValue creates a literal value of type Null.

func ObjectValue

func ObjectValue(d types.Object) expr.LiteralValue

ObjectValue creates a literal value of type Object.

func ParseExpr

func ParseExpr(t testing.TB, s string) expr.Expr

func ParseExprs

func ParseExprs(t testing.TB, s ...string) []expr.Expr

func ParseNamedExpr

func ParseNamedExpr(t testing.TB, s string, name ...string) expr.Expr

func ParseObjectPath

func ParseObjectPath(t testing.TB, p string) object.Path

func ParseObjectPaths

func ParseObjectPaths(t testing.TB, str ...string) []object.Path

func ParsePath

func ParsePath(t testing.TB, p string) expr.Path

func Query

func RequireArrayEqual

func RequireArrayEqual(t testing.TB, want, got types.Array)

func RequireJSONEq

func RequireJSONEq(t testing.TB, o any, expected string)

func RequireObjEqual

func RequireObjEqual(t testing.TB, want, got types.Object)

func RequireStreamEq

func RequireStreamEq(t *testing.T, raw string, res *chai.Result, sorted bool)

func RequireStreamEqf

func RequireStreamEqf(t *testing.T, raw string, res *chai.Result, sorted bool, msg string, args ...any)

func RequireValueEqual

func RequireValueEqual(t testing.TB, want, got types.Value, msg string, args ...any)

func TestExpr

func TestExpr(t testing.TB, exprStr string, env *environment.Environment, want types.Value, fails bool)

func TextValue

func TextValue(v string) expr.LiteralValue

TextValue creates a literal value of type Text.

Types

type Objs

type Objs []types.Object

func MakeObjects

func MakeObjects(t testing.TB, jsonDocs ...string) (docs Objs)

MakeObjects creates a slice of objects from json strings.

func (Objs) RequireEqual

func (o Objs) RequireEqual(t testing.TB, others Objs)

type ResultStream

type ResultStream struct {
	*parser.Parser
	// contains filtered or unexported fields
}

func ParseResultStream

func ParseResultStream(stream string) *ResultStream

func (*ResultStream) Next

func (ds *ResultStream) Next() (types.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL