Skip to content

Commit

Permalink
Mark the decompress tester as a helper for helpful failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Nov 17, 2018
1 parent 7ee49f6 commit 08c221b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions decompress_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ import (

// TestDecompressCase is a single test case for testing decompressors
type TestDecompressCase struct {
Input string // Input is the complete path to the input file
Dir bool // Dir is whether or not we're testing directory mode
Err bool // Err is whether we expect an error or not
DirList []string // DirList is the list of files for Dir mode
FileMD5 string // FileMD5 is the expected MD5 for a single file
Mtime *time.Time // Mtime is the optionally expected mtime for a single file (or all files if in Dir mode)
Input string // Input is the complete path to the input file
Dir bool // Dir is whether or not we're testing directory mode
Err bool // Err is whether we expect an error or not
DirList []string // DirList is the list of files for Dir mode
FileMD5 string // FileMD5 is the expected MD5 for a single file
Mtime *time.Time // Mtime is the optionally expected mtime for a single file (or all files if in Dir mode)
}

// TestDecompressor is a helper function for testing generic decompressors.
func TestDecompressor(t testing.T, d Decompressor, cases []TestDecompressCase) {
t.Helper()

for _, tc := range cases {
t.Logf("Testing: %s", tc.Input)

Expand Down

0 comments on commit 08c221b

Please # to comment.