package fly_weight import ( "github.com/bmizerany/assert" "testing" ) func TestFlyWeightFactory_GetFlyWeight(t *testing.T) { factory := NewFlyWeightFactory() a := factory.GetFlyWeight("啊啊啊") b := factory.GetFlyWeight("不不不") // assert.Len(&t, factory.pool, 2) assert.Equal(t, a, factory.pool["啊啊啊"]) assert.Equal(t, b, factory.pool["不不不"]) }