Skip to content

Commit eb19964

Browse files
committed
TestIsArchivePathDir: remove shelling out to create dir
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 2293f47 commit eb19964

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

archive_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,10 @@ func toUnixPath(p string) string {
9898

9999
func TestIsArchivePathDir(t *testing.T) {
100100
tmp := t.TempDir()
101-
cmd := exec.Command("sh", "-c", fmt.Sprintf("mkdir -p %s/archivedir", toUnixPath(tmp)))
102-
output, err := cmd.CombinedOutput()
103-
if err != nil {
104-
t.Fatalf("Failed to create directory (%v): %s", err, output)
105-
}
106-
if IsArchivePath(filepath.Join(tmp, "archivedir")) {
107-
t.Fatalf("Incorrectly recognised directory as an archive")
108-
}
101+
assert.NilError(t, os.Mkdir(filepath.Join(tmp, "archivedir"), 0o755))
102+
103+
assert.Check(t, !IsArchivePath(filepath.Join(tmp, "archivedir")),
104+
"incorrectly recognised directory as an archive")
109105
}
110106

111107
func TestIsArchivePathInvalidFile(t *testing.T) {

0 commit comments

Comments
 (0)