Add unit test for duplicate file names
This commit is contained in:
parent
eaa2d26ca9
commit
db9866719b
1 changed files with 14 additions and 0 deletions
14
src/write.rs
14
src/write.rs
|
@ -1636,6 +1636,20 @@ mod test {
|
||||||
assert_eq!(second_file_content, RT_TEST_TEXT);
|
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]
|
#[test]
|
||||||
fn path_to_string() {
|
fn path_to_string() {
|
||||||
let mut path = std::path::PathBuf::new();
|
let mut path = std::path::PathBuf::new();
|
||||||
|
|
Loading…
Add table
Reference in a new issue