Add tests for blob_fname failing cases

This commit is contained in:
Nick Mathewson 2020-11-30 12:35:33 -05:00
parent 39bc39ddd5
commit a1d02d4154
1 changed files with 17 additions and 0 deletions

View File

@ -667,6 +667,23 @@ mod test {
Ok(())
}
#[test]
fn bad_blob_fnames() -> Result<()> {
let (_tmp_dir, store) = new_empty()?;
assert!(store.blob_fname("abcd").is_ok());
assert!(store.blob_fname("abcd..").is_ok());
assert!(store.blob_fname("..abcd..").is_ok());
assert!(store.blob_fname(".abcd").is_ok());
assert!(store.blob_fname(".").is_err());
assert!(store.blob_fname("..").is_err());
assert!(store.blob_fname("../abcd").is_err());
assert!(store.blob_fname("/abcd").is_err());
Ok(())
}
#[test]
fn blobs() -> Result<()> {
let (tmp_dir, mut store) = new_empty()?;