mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Add invalid data test for Index/Index2
This commit is contained in:
parent
cfe08de0d7
commit
f460f5b944
1 changed files with 28 additions and 1 deletions
27
src/index.rs
27
src/index.rs
|
@ -161,3 +161,30 @@ impl Index2File {
|
|||
self.entries.iter().find(|s| s.hash == hash)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_index_invalid() {
|
||||
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
d.push("resources/tests");
|
||||
d.push("random");
|
||||
|
||||
// Feeding it invalid data should not panic
|
||||
IndexFile::from_existing(d.to_str().unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_index2_invalid() {
|
||||
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
d.push("resources/tests");
|
||||
d.push("random");
|
||||
|
||||
// Feeding it invalid data should not panic
|
||||
Index2File::from_existing(d.to_str().unwrap());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue