From: Shawn Smith Date: Sat, 28 Dec 2013 05:14:49 +0000 (+1100) Subject: archive/tar: add test case for passing nil to FileInfoHeader X-Git-Tag: go1.3beta1~1100 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=42cea1a452a227b0c08d5bc181b590e29b5beda9;p=gostls13.git archive/tar: add test case for passing nil to FileInfoHeader R=golang-codereviews, dave CC=golang-codereviews https://golang.org/cl/44710044 --- diff --git a/src/pkg/archive/tar/tar_test.go b/src/pkg/archive/tar/tar_test.go index 616a9cc57e..ed333f3ea4 100644 --- a/src/pkg/archive/tar/tar_test.go +++ b/src/pkg/archive/tar/tar_test.go @@ -36,6 +36,10 @@ func TestFileInfoHeader(t *testing.T) { if g, e := h.ModTime, fi.ModTime(); !g.Equal(e) { t.Errorf("ModTime = %v; want %v", g, e) } + // FileInfoHeader should error when passing nil FileInfo + if _, err := FileInfoHeader(nil, ""); err == nil { + t.Fatalf("Expected error when passing nil to FileInfoHeader") + } } func TestFileInfoHeaderDir(t *testing.T) {