go/store/datas: Remove some usage of Format_Default.

This commit is contained in:
Aaron Son
2022-05-10 16:20:10 -07:00
parent 0cc161365b
commit 0558d9a99a
3 changed files with 23 additions and 22 deletions
+3 -3
View File
@@ -53,7 +53,7 @@ func TestValidateRef(t *testing.T) {
_, err = db.validateRefAsCommit(context.Background(), r)
assert.Error(t, err)
_, err = db.validateRefAsCommit(context.Background(), mustRef(types.NewRef(b, types.Format_Default)))
_, err = db.validateRefAsCommit(context.Background(), mustRef(types.NewRef(b, db.Format())))
}
type DatabaseSuite struct {
@@ -92,7 +92,7 @@ func (suite *DatabaseSuite) TearDownTest() {
func (suite *RemoteDatabaseSuite) TestWriteRefToNonexistentValue() {
ds, err := suite.db.GetDataset(context.Background(), "foo")
suite.NoError(err)
r, err := types.NewRef(types.Bool(true), types.Format_Default)
r, err := types.NewRef(types.Bool(true), suite.db.Format())
suite.NoError(err)
suite.Panics(func() { CommitValue(context.Background(), suite.db, ds, r) })
}
@@ -121,7 +121,7 @@ func (suite *DatabaseSuite) TestCompletenessCheck() {
suite.NoError(err)
s = mustHeadValue(ds1).(types.Set)
ref, err := types.NewRef(types.Float(1000), types.Format_Default)
ref, err := types.NewRef(types.Float(1000), suite.db.Format())
suite.NoError(err)
se, err = s.Edit().Insert(ref)
suite.NoError(err)
+19 -18
View File
@@ -142,6 +142,10 @@ func tempDirDB(ctx context.Context) (types.ValueReadWriter, datas.Database, erro
}
func TestPuller(t *testing.T) {
ctx := context.Background()
vs, db, err := tempDirDB(ctx)
require.NoError(t, err)
deltas := []struct {
name string
sets map[string][]types.Value
@@ -158,12 +162,12 @@ func TestPuller(t *testing.T) {
"employees",
map[string][]types.Value{
"employees": {
mustTuple(types.NewTuple(types.Format_Default, types.String("Hendriks"), types.String("Brian"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Software Engineer"), types.Int(39))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Sehn"), types.String("Timothy"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("CEO"), types.Int(39))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Son"), types.String("Aaron"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Software Engineer"), types.Int(36))),
mustTuple(types.NewTuple(vs.Format(), types.String("Hendriks"), types.String("Brian"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Software Engineer"), types.Int(39))),
mustTuple(types.NewTuple(vs.Format(), types.String("Sehn"), types.String("Timothy"))),
mustTuple(types.NewTuple(vs.Format(), types.String("CEO"), types.Int(39))),
mustTuple(types.NewTuple(vs.Format(), types.String("Son"), types.String("Aaron"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Software Engineer"), types.Int(36))),
},
},
map[string][]types.Value{},
@@ -198,12 +202,12 @@ func TestPuller(t *testing.T) {
"more employees",
map[string][]types.Value{
"employees": {
mustTuple(types.NewTuple(types.Format_Default, types.String("Jesuele"), types.String("Matt"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Software Engineer"), types.NullValue)),
mustTuple(types.NewTuple(types.Format_Default, types.String("Wilkins"), types.String("Daylon"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Software Engineer"), types.NullValue)),
mustTuple(types.NewTuple(types.Format_Default, types.String("Katie"), types.String("McCulloch"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Software Engineer"), types.NullValue)),
mustTuple(types.NewTuple(vs.Format(), types.String("Jesuele"), types.String("Matt"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Software Engineer"), types.NullValue)),
mustTuple(types.NewTuple(vs.Format(), types.String("Wilkins"), types.String("Daylon"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Software Engineer"), types.NullValue)),
mustTuple(types.NewTuple(vs.Format(), types.String("Katie"), types.String("McCulloch"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Software Engineer"), types.NullValue)),
},
},
map[string][]types.Value{},
@@ -220,18 +224,15 @@ func TestPuller(t *testing.T) {
map[string][]types.Value{},
map[string][]types.Value{
"employees": {
mustTuple(types.NewTuple(types.Format_Default, types.String("Hendriks"), types.String("Brian"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Sehn"), types.String("Timothy"))),
mustTuple(types.NewTuple(types.Format_Default, types.String("Son"), types.String("Aaron"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Hendriks"), types.String("Brian"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Sehn"), types.String("Timothy"))),
mustTuple(types.NewTuple(vs.Format(), types.String("Son"), types.String("Aaron"))),
},
},
[]string{},
},
}
ctx := context.Background()
vs, db, err := tempDirDB(ctx)
require.NoError(t, err)
ds, err := db.GetDataset(ctx, "ds")
require.NoError(t, err)
rootMap, err := types.NewMap(ctx, vs)
+1 -1
View File
@@ -45,7 +45,7 @@ func TestNewTag(t *testing.T) {
parents := mustList(types.NewList(ctx, db))
parentsClosure := mustParentsClosure(t, false)(getParentsClosure(ctx, db, parents))
commit, err := newCommit(ctx, types.Float(1), parents, parentsClosure, false, types.EmptyStruct(types.Format_Default))
commit, err := newCommit(ctx, types.Float(1), parents, parentsClosure, false, types.EmptyStruct(db.Format()))
require.NoError(t, err)
cmRef, err := db.WriteValue(ctx, commit)