aboutsummaryrefslogtreecommitdiff
path: root/src/command
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-03-07 00:14:30 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-03-07 00:14:30 +0100
commit18b0d988b86e7b9b78a83ca9ea70dfb195a52d20 (patch)
tree60d7c5c584cb43f6721eeec42a76bebd8f8e2f43 /src/command
parentcd63ee5ae6542f0603ab34ac9affc33f7c2e37eb (diff)
Style
Diffstat (limited to 'src/command')
-rw-r--r--src/command/generate.rs52
1 files changed, 18 insertions, 34 deletions
diff --git a/src/command/generate.rs b/src/command/generate.rs
index 5485b85..02325b6 100644
--- a/src/command/generate.rs
+++ b/src/command/generate.rs
@@ -159,46 +159,33 @@ mod tests {
);
// Create the posts
- create_dir_all(&posts_dir.join("0"))
- .expect("Could not create post 0 directory");
+ create_dir_all(&posts_dir.join("0")).expect("Could not create post 0 directory");
create_test_file(
&posts_dir.join("0/metadata.json"),
- "{ \"id\": \"1736035200000\", \"created_on\": 1736035200000 }"
- );
- create_test_file(
- &posts_dir.join("0/ignored"),
- "IGNORED"
- );
- create_test_file(
- &posts_dir.join("0/the-latest.gmi"),
- "The latest is here."
+ "{ \"id\": \"1736035200000\", \"created_on\": 1736035200000 }",
);
- create_dir_all(&posts_dir.join("1"))
- .expect("Could not create post 1 directory");
+ create_test_file(&posts_dir.join("0/ignored"), "IGNORED");
+ create_test_file(&posts_dir.join("0/the-latest.gmi"), "The latest is here.");
+ create_dir_all(&posts_dir.join("1")).expect("Could not create post 1 directory");
create_test_file(
&posts_dir.join("1/metadata.json"),
- "{ \"id\": \"1736045200000\", \"created_on\": 1736045200000 }"
+ "{ \"id\": \"1736045200000\", \"created_on\": 1736045200000 }",
);
- create_test_file(
- &posts_dir.join("1/the-latest.gmi"),
- "Often forgotten."
- );
- create_dir_all(&posts_dir.join("2"))
- .expect("Could not create post 2 directory");
+ create_test_file(&posts_dir.join("1/the-latest.gmi"), "Often forgotten.");
+ create_dir_all(&posts_dir.join("2")).expect("Could not create post 2 directory");
create_test_file(
&posts_dir.join("2/metadata.json"),
- "{ \"id\": \"1736045200009\", \"created_on\": 1736045200009 }"
+ "{ \"id\": \"1736045200009\", \"created_on\": 1736045200009 }",
);
- create_dir_all(&posts_dir.join("3"))
- .expect("Could not create post 3 directory");
+ create_dir_all(&posts_dir.join("3")).expect("Could not create post 3 directory");
let invalid_bytes = vec![0xFF, 0xFF, 0xFF, 0xFF];
create_test_file(
&posts_dir.join("3/metadata.json"),
- "{ \"id\": \"1736045200099\", \"created_on\": 1736045200099 }"
+ "{ \"id\": \"1736045200099\", \"created_on\": 1736045200099 }",
);
- let mut bad_file = File::create(&posts_dir.join("3/bad-file.gmi"))
- .expect("Could not create bad file.");
+ let mut bad_file =
+ File::create(&posts_dir.join("3/bad-file.gmi")).expect("Could not create bad file.");
bad_file
.write_all(&invalid_bytes)
.expect("Could not write bad bytes to bad file.");
@@ -208,22 +195,19 @@ mod tests {
.expect("Could not create post 0 directory");
create_test_file(
&archive_dir.join("1736035200000/metadata.json"),
- "{ \"id\": \"1736035200000\", \"created_on\": 1736035200000 }"
+ "{ \"id\": \"1736035200000\", \"created_on\": 1736035200000 }",
);
create_test_file(
&archive_dir.join("1736035200000/the-latest.gmi"),
- "The latest is here."
+ "The latest is here.",
);
create_dir_all(&archive_dir.join("1736045200000"))
.expect("Could not create post 1 archive directory");
create_test_file(
&archive_dir.join("1736045200000/metadata.json"),
- "{ \"id\": \"1736045200000\", \"created_on\": 1736045200000 }"
- );
- create_test_file(
- &posts_dir.join("1/the-latest.gmi"),
- "Often forgotten."
+ "{ \"id\": \"1736045200000\", \"created_on\": 1736045200000 }",
);
+ create_test_file(&posts_dir.join("1/the-latest.gmi"), "Often forgotten.");
let mut configuration = Configuration::new();
configuration.archive_directory = archive_dir.clone();
@@ -267,7 +251,7 @@ mod tests {
);
assert_file_contents(
&archive_output_dir.join("1736035200000/the-latest.gmi"),
- "The latest is here."
+ "The latest is here.",
);
cleanup_test_dir(&test_dir);