Example #1
0
func TestStructChunks(t *testing.T) {
	assert := assert.New(t)

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

	// One chunk for the Type
	assert.Len(chunks, 1)
}
Example #2
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))
}
Example #3
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())
}
Example #4
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())
}