github.phpd.cn/hashicorp/packer@v1.3.2/builder/hcloud/artifact_test.go (about) 1 package hcloud 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/packer/packer" 7 ) 8 9 func TestArtifact_Impl(t *testing.T) { 10 var _ packer.Artifact = (*Artifact)(nil) 11 } 12 13 func TestArtifactId(t *testing.T) { 14 a := &Artifact{"packer-foobar", 42, nil} 15 expected := "42" 16 17 if a.Id() != expected { 18 t.Fatalf("artifact ID should match: %v", expected) 19 } 20 } 21 22 func TestArtifactString(t *testing.T) { 23 a := &Artifact{"packer-foobar", 42, nil} 24 expected := "A snapshot was created: 'packer-foobar' (ID: 42)" 25 26 if a.String() != expected { 27 t.Fatalf("artifact string should match: %v", expected) 28 } 29 }