From 4b41500f2d9a6d6b15d95077578ebcd7a4655247 Mon Sep 17 00:00:00 2001 From: Pete Emerson Date: Mon, 26 Oct 2020 12:53:19 -0700 Subject: [PATCH] Add file count test when extracting files --- file_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/file_test.go b/file_test.go index c36e297..114ed8d 100644 --- a/file_test.go +++ b/file_test.go @@ -307,11 +307,15 @@ func TestExtractFiles(t *testing.T) { } defer os.RemoveAll(tempDir) - _, err = extractFiles(tc.localFilePath, tc.filePathToExtract, tempDir) + fileCount, err := extractFiles(tc.localFilePath, tc.filePathToExtract, tempDir) if err != nil { t.Fatalf("Failed to extract files: %s", err) } + if fileCount != tc.expectedNumFiles { + t.Fatalf("Expected to extract %d files, extracted %d instead", tc.expectedNumFiles, fileCount) + } + // Count the number of files in the directory var numFiles int filepath.Walk(tempDir, func(path string, info os.FileInfo, err error) error {