diff options
| author | Mel <einebeere@gmail.com> | 2021-10-10 21:35:47 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-10 21:35:47 +0200 |
| commit | d57e10663a2f0c6999c04726fac9a9a18ba4a97d (patch) | |
| tree | 5b43d6c8c5cd1cec7d2ecadd4cde662f7b39a293 /src/actions/create.rs | |
| parent | b7650c22dbb42a7eeb55d148610c893a74280369 (diff) | |
| download | ka-d57e10663a2f0c6999c04726fac9a9a18ba4a97d.tar.zst ka-d57e10663a2f0c6999c04726fac9a9a18ba4a97d.zip | |
Format
Diffstat (limited to 'src/actions/create.rs')
| -rw-r--r-- | src/actions/create.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/actions/create.rs b/src/actions/create.rs index 2b664b3..c89c3c9 100644 --- a/src/actions/create.rs +++ b/src/actions/create.rs @@ -26,7 +26,14 @@ pub fn create(command_options: ActionOptions, fs: &impl Fs, timestamp: u64) -> R mod tests { use std::path::Path; - use crate::{actions::ActionOptions, diff::ContentChange, filesystem::mock::{EntryMock, FsMock, FsState}, history::{FileChange, FileChangeVariant, FileHistory, RepositoryChange, RepositoryHistory}}; + use crate::{ + actions::ActionOptions, + diff::ContentChange, + filesystem::mock::{EntryMock, FsMock, FsState}, + history::{ + FileChange, FileChangeVariant, FileHistory, RepositoryChange, RepositoryHistory, + }, + }; use super::create; @@ -37,7 +44,7 @@ mod tests { let options = ActionOptions::from_path("."); let expected_index = RepositoryHistory::default().encode().unwrap(); - + create(options, &fs_mock, now).expect("Action failed."); fs_mock.assert_match(FsState::new(vec![ @@ -76,19 +83,19 @@ mod tests { history.encode().unwrap() }; - fs_mock.set_state(FsState::new(vec![ - EntryMock::file("./test", &vec![1, 2, 3]) - ])); + fs_mock.set_state(FsState::new(vec![EntryMock::file( + "./test", + &vec![1, 2, 3], + )])); create(options, &fs_mock, now).expect("Action failed."); fs_mock.assert_match(FsState::new(vec![ EntryMock::file("./test", &vec![1, 2, 3]), - EntryMock::dir("./.ka"), EntryMock::file("./.ka/index", &expected_index), EntryMock::dir("./.ka/files"), EntryMock::file("./.ka/files/test", &expected_file_history), ])) } -} \ No newline at end of file +} |
