Documentation ¶
Overview ¶
Package dtestutils contains test utilities for testing the dolt command line.
Index ¶
- Constants
- Variables
- func AddColToRows(t *testing.T, rs []row.Row, tag uint64, val types.Value) []row.Row
- func AddColumnToSchema(sch schema.Schema, col schema.Column) schema.Schema
- func ConvertToSchema(sch schema.Schema, rs ...row.Row) []row.Row
- func CreateEnvWithSeedData(t *testing.T) *env.DoltEnv
- func CreateSchema(columns ...schema.Column) schema.Schema
- func CreateTestDataTable(typed bool) (*table.InMemTable, schema.Schema)
- func CreateTestEnv() *env.DoltEnv
- func CreateTestTable(t *testing.T, dEnv *env.DoltEnv, tableName string, sch schema.Schema, ...)
- func MustMap(t *testing.T, vrw types.ValueReadWriter, kv ...types.Value) types.Map
- func MustRowData(t *testing.T, ctx context.Context, vrw types.ValueReadWriter, ...) *types.Map
- func MustSchema(cols ...schema.Column) schema.Schema
- func MustTuple(vals ...types.Value) types.Tuple
- func NewRow(sch schema.Schema, values ...types.Value) row.Row
- func NewTypedRow(id uuid.UUID, name string, age uint, isMarried bool, title *string) row.Row
- func RemoveColumnFromSchema(sch schema.Schema, tagToRemove uint64) schema.Schema
Constants ¶
const ( IdTag uint64 = iota NameTag AgeTag IsMarriedTag TitleTag NextTag // leave last )
const ( TableName = "people" IndexName = "idx_name" )
const ( TestHomeDir = "/user/bheni" WorkingDir = "/user/bheni/datasets/states" )
Variables ¶
var Ages = []uint64{32, 25, 21}
var FloatComparer = cmp.Comparer(func(x, y types.Float) bool { return math.Abs(float64(x)-float64(y)) < .001 })
Compares two noms Floats for approximate equality
var MaritalStatus = []bool{true, false, false}
var Names = []string{"Bill Billerson", "John Johnson", "Rob Robertson"}
var TimestampComparer = cmp.Comparer(func(x, y types.Timestamp) bool {
return x.Equals(y)
})
var Titles = []string{"Senior Dufus", "Dufus", ""}
var TypedRows []row.Row
var TypedSchema = schema.MustSchemaFromCols(typedColColl)
modified by init()
var UUIDS = []uuid.UUID{ uuid.Must(uuid.Parse("00000000-0000-0000-0000-000000000000")), uuid.Must(uuid.Parse("00000000-0000-0000-0000-000000000001")), uuid.Must(uuid.Parse("00000000-0000-0000-0000-000000000002"))}
var UntypedRows []row.Row
var UntypedSchema, _ = untyped.UntypeSchema(TypedSchema)
modified by init()
Functions ¶
func AddColToRows ¶
AddColToRows adds a column to all the rows given and returns it. This method relies on the fact that noms_row.SetColVal doesn't need a full schema, just one that includes the column being set.
func AddColumnToSchema ¶
AddColumnToSchema returns a new schema by adding the given column to the given schema. Will panic on an invalid schema, e.g. tag collision. Note the AddColumnToSchema relies on being called from the engine (GMS) to correctly update defaults. Directly calling this method in Dolt only adds a new column to schema but does not apply the default.
func ConvertToSchema ¶
Coerces the rows given into the schema given. Only possible if the types are equivalent.
func CreateSchema ¶
CreateSchema returns a schema from the columns given, panicking on any errors.
func CreateTestDataTable ¶
func CreateTestDataTable(typed bool) (*table.InMemTable, schema.Schema)
func CreateTestEnv ¶
func CreateTestTable ¶
func CreateTestTable(t *testing.T, dEnv *env.DoltEnv, tableName string, sch schema.Schema, rs ...row.Row)
CreateTestTable creates a new test table with the name, schema, and rows given.
func MustRowData ¶
func MustRowData(t *testing.T, ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema, colVals []row.TaggedValues) *types.Map
MustRowData converts a slice of row.TaggedValues into a noms types.Map containing that data.
func MustSchema ¶
MustSchema takes a variable number of columns and returns a schema.
func NewRow ¶
Creates a row with the schema given, having the values given. Starts at tag 0 and counts up.
func NewTypedRow ¶
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
Package testcommands TODO: kill off this package, replace with the non-test commands directly
|
Package testcommands TODO: kill off this package, replace with the non-test commands directly |