Skip to content

Commit

Permalink
Add unit test for tarSum.Sum() with no data
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Josh Hawn <[email protected]> (github: jlhawn)
  • Loading branch information
Josh Hawn authored and vbatts committed Nov 19, 2014
1 parent 6a74f07 commit e257863
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/tarsum/tarsum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ func TestEmptyTar(t *testing.T) {
if resultSum != expectedSum {
t.Fatalf("expected [%s] but got [%s]", expectedSum, resultSum)
}

// Test without ever actually writing anything.
if ts, err = NewTarSum(bytes.NewReader([]byte{}), true, Version0); err != nil {
t.Fatal(err)
}

resultSum = ts.Sum(nil)

if resultSum != expectedSum {
t.Fatalf("expected [%s] but got [%s]", expectedSum, resultSum)
}
}

var (
Expand Down

0 comments on commit e257863

Please sign in to comment.