github.com/remind101/go-getter@v0.0.0-20180809191950-4bda8fa99001/decompress_tar_test.go (about)

     1  package getter
     2  
     3  import (
     4  	"path/filepath"
     5  	"testing"
     6  	"time"
     7  )
     8  
     9  func TestTar(t *testing.T) {
    10  	mtime := time.Unix(0, 0)
    11  	cases := []TestDecompressCase{
    12  		{
    13  			"extended_header.tar",
    14  			true,
    15  			false,
    16  			[]string{"directory/", "directory/a", "directory/b"},
    17  			"",
    18  			nil,
    19  		},
    20  		{
    21  			"implied_dir.tar",
    22  			true,
    23  			false,
    24  			[]string{"directory/", "directory/sub/", "directory/sub/a", "directory/sub/b"},
    25  			"",
    26  			nil,
    27  		},
    28  		{
    29  			"unix_time_0.tar",
    30  			true,
    31  			false,
    32  			[]string{"directory/", "directory/sub/", "directory/sub/a", "directory/sub/b"},
    33  			"",
    34  			&mtime,
    35  		},
    36  	}
    37  
    38  	for i, tc := range cases {
    39  		cases[i].Input = filepath.Join("./test-fixtures", "decompress-tar", tc.Input)
    40  	}
    41  
    42  	TestDecompressor(t, new(tarDecompressor), cases)
    43  }