Skip to content

Commit

Permalink
Add corrupted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Oct 28, 2017
1 parent a464d95 commit 5e29fc6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions unarr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,24 @@ func TestList(t *testing.T) {
a.Close()
}
}

func TestCorrupted(t *testing.T) {
a, err := NewArchive(filepath.Join("testdata", "test_corrupted.zip"))
if err != nil {
t.Error(err)
}

defer a.Close()

err = a.Entry()
if err == nil {
t.Error("Corrupted entry parsed")
}
}

func TestNotValid(t *testing.T) {
_, err := NewArchive(filepath.Join("testdata", "test_notvalid.zip"))
if err == nil {
t.Error("Not valid archive opened")
}
}

0 comments on commit 5e29fc6

Please sign in to comment.