Add test coverage for pkg/tarsum
And removing unused code. - tarsum.go : NewTarSumHash could be non exported (for now) NewTarSumForLabel is never used, except for the tests - fileinfosums.go: SortByPos is never used, except for the tests - versionning.go: GetVersions is never used, expect for the tests Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
b538852b61
commit
e4059984de
5 changed files with 199 additions and 9 deletions
|
@ -42,4 +42,21 @@ func TestSortFileInfoSums(t *testing.T) {
|
|||
if gotFis.Pos() != 4 {
|
||||
t.Errorf("Expected %d, got %d", 4, gotFis.Pos())
|
||||
}
|
||||
|
||||
fis = newFileInfoSums()
|
||||
fis.SortByPos()
|
||||
if fis[0].Pos() != 0 {
|
||||
t.Errorf("sorted fileInfoSums by Pos should order them by position.")
|
||||
}
|
||||
|
||||
fis = newFileInfoSums()
|
||||
expected = "deadbeef1"
|
||||
gotFileInfoSum := fis.GetFile("dup1")
|
||||
if gotFileInfoSum.Sum() != expected {
|
||||
t.Errorf("Expected %q, got %q", expected, gotFileInfoSum)
|
||||
}
|
||||
if fis.GetFile("noPresent") != nil {
|
||||
t.Errorf("Should have return nil if name not found.")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue