github.com/openshift/installer@v1.4.17/pkg/asset/parents_test.go (about)

     1  package asset
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  type parentsAsset struct {
    11  	x int
    12  }
    13  
    14  func (a *parentsAsset) Name() string {
    15  	return "parents-asset"
    16  }
    17  
    18  func (a *parentsAsset) Dependencies() []Asset {
    19  	return []Asset{}
    20  }
    21  
    22  func (a *parentsAsset) Generate(context.Context, Parents) error {
    23  	return nil
    24  }
    25  
    26  func TestParentsGetPointer(t *testing.T) {
    27  	origAsset := &parentsAsset{x: 1}
    28  	parents := Parents{}
    29  	parents.Add(origAsset)
    30  
    31  	retrievedAsset := &parentsAsset{}
    32  	parents.Get(retrievedAsset)
    33  	assert.Equal(t, 1, retrievedAsset.x)
    34  }