forked from Deuxfleurs/garage
Add a second test
This commit is contained in:
parent
9a50ce12a8
commit
e1415f5976
1 changed files with 12 additions and 1 deletions
|
@ -275,10 +275,21 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_bucket_with_key() -> Result<(), Error> {
|
fn parse_bucket_containing_a_key() -> Result<(), Error> {
|
||||||
let (bucket, key) = parse_bucket_key("/my_bucket/a/super/file.jpg")?;
|
let (bucket, key) = parse_bucket_key("/my_bucket/a/super/file.jpg")?;
|
||||||
assert_eq!(bucket, "my_bucket");
|
assert_eq!(bucket, "my_bucket");
|
||||||
assert_eq!(key.expect("key must be set"), "a/super/file.jpg");
|
assert_eq!(key.expect("key must be set"), "a/super/file.jpg");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn parse_bucket_containing_no_key() -> Result<(), Error> {
|
||||||
|
let (bucket, key) = parse_bucket_key("/my_bucket/")?;
|
||||||
|
assert_eq!(bucket, "my_bucket");
|
||||||
|
assert!(key.is_none());
|
||||||
|
let (bucket, key) = parse_bucket_key("/my_bucket")?;
|
||||||
|
assert_eq!(bucket, "my_bucket");
|
||||||
|
assert!(key.is_none());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue