summaryrefslogtreecommitdiff
path: root/crates/utils/cfg_file/cfg_file_test/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/utils/cfg_file/cfg_file_test/src/lib.rs')
-rw-r--r--crates/utils/cfg_file/cfg_file_test/src/lib.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/crates/utils/cfg_file/cfg_file_test/src/lib.rs b/crates/utils/cfg_file/cfg_file_test/src/lib.rs
index ea490c9..fd805f1 100644
--- a/crates/utils/cfg_file/cfg_file_test/src/lib.rs
+++ b/crates/utils/cfg_file/cfg_file_test/src/lib.rs
@@ -4,10 +4,10 @@ pub fn add(left: u64, right: u64) -> u64 {
#[cfg(test)]
mod test_cfg_file {
- use std::collections::HashMap;
- use serde::{Deserialize, Serialize};
- use cfg_file::config::ConfigFile;
use cfg_file::ConfigFile;
+ use cfg_file::config::ConfigFile;
+ use serde::{Deserialize, Serialize};
+ use std::collections::HashMap;
#[derive(ConfigFile, Deserialize, Serialize, Default)]
#[cfg_file(path = "./.temp/example_cfg.toml")]
@@ -23,19 +23,22 @@ mod test_cfg_file {
let mut example = ExampleConfig {
name: "Weicao".to_string(),
age: 22,
- hobby: vec![ "Programming", "Painting" ]
+ hobby: vec!["Programming", "Painting"]
.iter()
.map(|m| m.to_string())
.collect(),
- secret: HashMap::new()
+ secret: HashMap::new(),
};
- let secret_no_comments = "Actually, I'm really too lazy to write comments, documentation, and unit tests.";
- example.secret
+ let secret_no_comments =
+ "Actually, I'm really too lazy to write comments, documentation, and unit tests.";
+ example
+ .secret
.entry("No comments".to_string())
.insert_entry(secret_no_comments.to_string());
let secret_peek = "Of course, it's peeking at you who's reading the source code.";
- example.secret
+ example
+ .secret
.entry("Peek".to_string())
.insert_entry(secret_peek.to_string());
@@ -45,8 +48,8 @@ mod test_cfg_file {
let read_cfg = ExampleConfig::read().await;
assert_eq!(read_cfg.name, "Weicao");
assert_eq!(read_cfg.age, 22);
- assert_eq!(read_cfg.hobby, vec![ "Programming", "Painting" ]);
+ assert_eq!(read_cfg.hobby, vec!["Programming", "Painting"]);
assert_eq!(read_cfg.secret["No comments"], secret_no_comments);
assert_eq!(read_cfg.secret["Peek"], secret_peek);
}
-} \ No newline at end of file
+}