diff --git a/src/write.rs b/src/write.rs index 581cf1f7..7b069c33 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1636,6 +1636,20 @@ mod test { assert_eq!(second_file_content, RT_TEST_TEXT); } + #[test] + fn duplicate_filenames() { + let mut writer = ZipWriter::new(io::Cursor::new(Vec::new())); + writer + .start_file("foo/bar/test", FileOptions::default()) + .unwrap(); + writer + .write("The quick brown 🦊 jumps over the lazy 🐕".as_bytes()) + .unwrap(); + writer + .start_file("foo/bar/test", FileOptions::default()) + .expect_err("Expected duplicate filename not to be allowed"); + } + #[test] fn path_to_string() { let mut path = std::path::PathBuf::new();