github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/gosbom/formats/text/encoder_test.go (about)

     1  package text
     2  
     3  import (
     4  	"flag"
     5  	"testing"
     6  
     7  	"github.com/nextlinux/gosbom/gosbom/formats/internal/testutils"
     8  )
     9  
    10  var updateTextEncoderGoldenFiles = flag.Bool("update-text", false, "update the *.golden files for text encoder")
    11  
    12  func TestTextDirectoryEncoder(t *testing.T) {
    13  	testutils.AssertEncoderAgainstGoldenSnapshot(t,
    14  		Format(),
    15  		testutils.DirectoryInput(t),
    16  		*updateTextEncoderGoldenFiles,
    17  		false,
    18  	)
    19  }
    20  
    21  func TestTextImageEncoder(t *testing.T) {
    22  	testImage := "image-simple"
    23  	testutils.AssertEncoderAgainstGoldenImageSnapshot(t,
    24  		Format(),
    25  		testutils.ImageInput(t, testImage, testutils.FromSnapshot()),
    26  		testImage,
    27  		*updateTextEncoderGoldenFiles,
    28  		false,
    29  	)
    30  }