From ceb8a4faf7144b81b13efed33a57655de9268640 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sat, 18 Jan 2025 13:27:13 +0100 Subject: Format --- src/command/update.rs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/command/update.rs b/src/command/update.rs index fedec13..e415872 100644 --- a/src/command/update.rs +++ b/src/command/update.rs @@ -145,17 +145,16 @@ mod tests { create_test_file(&test_file, "# I try."); // Update 1 of 2 - update.execute(Some(&test_file_string), &configuration, "update") + update + .execute(Some(&test_file_string), &configuration, "update") .expect("Could not update a .gmi"); assert!(&posts_dir.join("0").exists()); assert_file_contents(&posts_dir.join("0/cool-test-file-😎.gmi"), "# I try."); - let entries = read_dir(&archive_dir) - .expect("Could not read archive"); + let entries = read_dir(&archive_dir).expect("Could not read archive"); let mut found_path = PathBuf::new(); for entry in entries { - let entry = entry - .expect("Could not read entry"); + let entry = entry.expect("Could not read entry"); found_path = entry.path(); assert_file_contents(&found_path.join("cool-test-file-😎.gmi"), "# I try."); assert!(&found_path.join("metadata.json").exists()); @@ -167,10 +166,17 @@ mod tests { create_test_file(&second_test_file, "# I REALLY try."); // Update 2 of 2 - update.execute(Some(&second_test_file_string), &configuration, "update") + update + .execute(Some(&second_test_file_string), &configuration, "update") .expect("Could not update a .gmi"); - assert_file_contents(&posts_dir.join("0/cooler-test-file-😎.gmi"), "# I REALLY try."); - assert_file_contents(&found_path.join("cooler-test-file-😎.gmi"), "# I REALLY try."); + assert_file_contents( + &posts_dir.join("0/cooler-test-file-😎.gmi"), + "# I REALLY try.", + ); + assert_file_contents( + &found_path.join("cooler-test-file-😎.gmi"), + "# I REALLY try.", + ); cleanup_test_dir(&test_dir); } @@ -186,7 +192,7 @@ mod tests { // Create metadata let metadata = Metadata { id: "1234".to_string(), - created_on: 1234 + created_on: 1234, }; // Update 1 of 2 @@ -214,11 +220,13 @@ mod tests { create_test_file(&test_file, "# Unlike a Bird"); create_test_file(&nested_test_file, "# Very much like a Bird"); - Update::archive(&source_dir, &target_dir) - .expect("Could not archive the test directories"); + Update::archive(&source_dir, &target_dir).expect("Could not archive the test directories"); assert_file_contents(&target_dir.join("not_nested.gmi"), "# Unlike a Bird"); - assert_file_contents(&target_dir.join("nested/very_much_nested.gmi"), "# Very much like a Bird"); + assert_file_contents( + &target_dir.join("nested/very_much_nested.gmi"), + "# Very much like a Bird", + ); cleanup_test_dir(&test_dir); } -- cgit