mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
* [wip] single sbom doc Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix more tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * fix linting Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update cli tests Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * remove scope in import path Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * swap SPDX tag-value formatter to single sbom document Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * bust CLI cache Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * update fixture to byte diff Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * byte for byte Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * bust the cache Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * who needs cache Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * add jar for testing Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * no more bit flips Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * update apk with the delta for image and directory cases Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> * restore cache workflow Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com> Co-authored-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
48 lines
921 B
Go
48 lines
921 B
Go
package table
|
|
|
|
import (
|
|
"flag"
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/internal/formats/common/testutils"
|
|
"github.com/go-test/deep"
|
|
)
|
|
|
|
var updateTableGoldenFiles = flag.Bool("update-table", false, "update the *.golden files for table format")
|
|
|
|
func TestTablePresenter(t *testing.T) {
|
|
testutils.AssertPresenterAgainstGoldenSnapshot(t,
|
|
Format().Presenter(testutils.DirectoryInput(t)),
|
|
*updateTableGoldenFiles,
|
|
)
|
|
}
|
|
|
|
func TestRemoveDuplicateRows(t *testing.T) {
|
|
data := [][]string{
|
|
{"1", "2", "3"},
|
|
{"a", "b", "c"},
|
|
{"1", "2", "3"},
|
|
{"a", "b", "c"},
|
|
{"1", "2", "3"},
|
|
{"4", "5", "6"},
|
|
{"1", "2", "1"},
|
|
}
|
|
|
|
expected := [][]string{
|
|
{"1", "2", "3"},
|
|
{"a", "b", "c"},
|
|
{"4", "5", "6"},
|
|
{"1", "2", "1"},
|
|
}
|
|
|
|
actual := removeDuplicateRows(data)
|
|
|
|
if diffs := deep.Equal(expected, actual); len(diffs) > 0 {
|
|
t.Errorf("found diffs!")
|
|
for _, d := range diffs {
|
|
t.Errorf(" diff: %+v", d)
|
|
}
|
|
}
|
|
|
|
}
|