Пример #1
0
func TestValue(t *testing.T) {
	assert := assert.New(t)

	def := gen.StructDef{"hi", true}
	var st types.Value
	st = def.New()
	st2 := st.(gen.Struct)
	assert.True(st.Equals(st2))
}
Пример #2
0
func TestType(t *testing.T) {
	assert := assert.New(t)

	def := gen.StructDef{"hi", true}
	st := def.New()
	typ := st.Type()
	assert.EqualValues(0, typ.Ordinal())
	assert.Equal(types.UnresolvedKind, typ.Kind())
}
Пример #3
0
func TestDef(t *testing.T) {
	assert := assert.New(t)

	def := gen.StructDef{"hi", true}
	st := def.New()

	def2 := st.Def()
	st2 := def.New()

	assert.Equal(def, def2)
	assert.True(st.Equals(st2))

	st3 := gen.NewStruct()
	st3 = st3.SetS("hi").SetB(true)
	assert.Equal("hi", st3.S())
	assert.Equal(true, st3.B())
}