mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-15 00:50:22 -06:00
move test fns
This commit is contained in:
@@ -307,14 +307,14 @@ func TestMergeCommits(t *testing.T) {
|
||||
mergedRows, err := merged.GetRowData(context.Background())
|
||||
assert.NoError(t, err)
|
||||
|
||||
prolly.MustEqual(t, durable.ProllyMapFromIndex(expectedRows), durable.ProllyMapFromIndex(mergedRows))
|
||||
MustEqualProlly(t, durable.ProllyMapFromIndex(expectedRows), durable.ProllyMapFromIndex(mergedRows))
|
||||
|
||||
for _, index := range sch.Indexes().AllIndexes() {
|
||||
mergedIndexRows, err := merged.GetIndexRowData(context.Background(), index.Name())
|
||||
require.NoError(t, err)
|
||||
expectedIndexRows, err := expected.GetIndexRowData(context.Background(), index.Name())
|
||||
require.NoError(t, err)
|
||||
prolly.MustEqual(t, durable.ProllyMapFromIndex(expectedIndexRows), durable.ProllyMapFromIndex(mergedIndexRows))
|
||||
MustEqualProlly(t, durable.ProllyMapFromIndex(expectedIndexRows), durable.ProllyMapFromIndex(mergedIndexRows))
|
||||
}
|
||||
|
||||
h, err := merged.HashOf()
|
||||
@@ -752,6 +752,17 @@ func mustString(str string, err error) string {
|
||||
return str
|
||||
}
|
||||
|
||||
func MustDebugFormatProlly(t *testing.T, m prolly.Map) string {
|
||||
s, err := prolly.DebugFormat(context.Background(), m)
|
||||
require.NoError(t, err)
|
||||
return s
|
||||
}
|
||||
|
||||
func MustEqualProlly(t *testing.T, expected prolly.Map, actual prolly.Map) {
|
||||
require.Equal(t, expected.HashOf(), actual.HashOf(),
|
||||
"hashes differed. expected: %s\nactual: %s", MustDebugFormatProlly(t, expected), MustDebugFormatProlly(t, actual))
|
||||
}
|
||||
|
||||
//func diffStr(t tree.Diff, kD val.TupleDesc) string {
|
||||
// var str string
|
||||
// switch t.Type {
|
||||
|
||||
@@ -19,9 +19,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/dolthub/dolt/go/store/hash"
|
||||
"github.com/dolthub/dolt/go/store/prolly/tree"
|
||||
@@ -273,14 +270,3 @@ func DebugFormat(ctx context.Context, m Map) (string, error) {
|
||||
sb.WriteString("}")
|
||||
return sb.String(), nil
|
||||
}
|
||||
|
||||
func MustDebugFormat(t *testing.T, m Map) string {
|
||||
s, err := DebugFormat(context.Background(), m)
|
||||
require.NoError(t, err)
|
||||
return s
|
||||
}
|
||||
|
||||
func MustEqual(t *testing.T, expected Map, actual Map) {
|
||||
require.Equal(t, expected.HashOf(), actual.HashOf(),
|
||||
"hashes differed. expected: %s\nactual: %s", MustDebugFormat(t, expected), MustDebugFormat(t, actual))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user