mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
32 lines
919 B
Go
32 lines
919 B
Go
package text
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/source"
|
|
|
|
"github.com/anchore/syft/internal/formats/common/testutils"
|
|
"github.com/anchore/syft/syft/format"
|
|
)
|
|
|
|
var updateTextPresenterGoldenFiles = flag.Bool("update-text", false, "update the *.golden files for text presenters")
|
|
|
|
func TestTextDirectoryPresenter(t *testing.T) {
|
|
catalog, metadata, d := testutils.DirectoryInput(t)
|
|
testutils.AssertPresenterAgainstGoldenSnapshot(t,
|
|
format.NewPresenter(encoder, catalog, &metadata, d, source.UnknownScope),
|
|
*updateTextPresenterGoldenFiles,
|
|
)
|
|
}
|
|
|
|
func TestTextImagePresenter(t *testing.T) {
|
|
testImage := "image-simple"
|
|
catalog, metadata, d := testutils.ImageInput(t, testImage, testutils.FromSnapshot())
|
|
testutils.AssertPresenterAgainstGoldenImageSnapshot(t,
|
|
format.NewPresenter(encoder, catalog, &metadata, d, source.SquashedScope),
|
|
testImage,
|
|
*updateTextPresenterGoldenFiles,
|
|
)
|
|
}
|