New architecture

This commit is contained in:
Adrian Heine 2019-12-26 20:50:23 +01:00
parent e4b3424ba6
commit 907a4962c5
61 changed files with 2742 additions and 3100 deletions

View file

@ -16,7 +16,7 @@ fn get_dir<'a, I: IntoIterator<Item = &'a &'a str>>(content: I) -> TempDir {
}
fn get_storage(path: &Path) -> SimpleStorage {
SimpleStorage::new(path.to_str().unwrap().into(), "filename".into())
SimpleStorage::new(path.join("_filename"))
}
// Normal cases
@ -29,7 +29,7 @@ fn single_file() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert_eq!(
dir.path().join("_filename").join("12345"),
@ -46,7 +46,7 @@ fn two_files() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert_eq!(
dir.path().join("_filename").join("23456"),
@ -63,7 +63,7 @@ fn another_two_files() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert_eq!(
dir.path().join("_filename").join("23456"),
@ -80,7 +80,7 @@ fn three_files() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert_eq!(
dir.path().join("_filename").join("23456"),
@ -99,7 +99,7 @@ fn empty_storage() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert!(storage.read_filename().is_err());
assert_eq!(
@ -121,7 +121,7 @@ fn empty_storage_for_filename() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert!(storage.read_filename().is_err());
assert_eq!(
@ -143,7 +143,7 @@ fn bad_file() {
assert!(
Regex::new(&format!("^{}/_filename/\\d+$", dir.path().display()))
.unwrap()
.is_match(&storage.write_filename())
.is_match(storage.write_filename().to_str().unwrap())
);
assert!(storage.read_filename().is_err());
assert_eq!(