mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-25 19:50:32 -05:00
c80a1c55b3
These were two representations of, essentially, the same information. They were separate because they provided different APIs to similar information, but the APIs became more similar once we started using native types (as opposed to Noms types) for the various Make*TypeRef() functions. Unifying these is a big step to unifying parse.Package and types.Package, which is pretty necessary for dealing with imported packages. Fixes issue #338
46 lines
851 B
Go
46 lines
851 B
Go
package test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/attic-labs/noms/Godeps/_workspace/src/github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDef(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
def := StructDef{"hi", true}
|
|
st := def.New()
|
|
|
|
def2 := st.Def()
|
|
st2 := def.New()
|
|
|
|
assert.Equal(def, def2)
|
|
assert.True(st.Equals(st2))
|
|
|
|
st3 := NewStruct()
|
|
st3 = st3.SetS("hi").SetB(true)
|
|
assert.Equal("hi", st3.S())
|
|
assert.Equal(true, st3.B())
|
|
}
|
|
|
|
func TestValue(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
def := StructDef{"hi", true}
|
|
st := def.New()
|
|
val := st.NomsValue()
|
|
st2 := StructFromVal(val)
|
|
assert.True(st.Equals(st2))
|
|
}
|
|
|
|
func TestType(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
def := StructDef{"hi", true}
|
|
st := def.New()
|
|
typ := st.Type()
|
|
assert.Equal("Struct", typ.Name())
|
|
assert.EqualValues(__testPackageInFile_struct_Ref(), typ.PackageRef())
|
|
}
|