From e60f5539ecbdf5a161481af6443869a0198d48da Mon Sep 17 00:00:00 2001 From: jameszow Date: Wed, 27 Dec 2023 19:32:10 +0800 Subject: [PATCH 1/3] fetch: remove test file in example module --- example/src/test.rs | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 example/src/test.rs diff --git a/example/src/test.rs b/example/src/test.rs deleted file mode 100644 index b6e65b0..0000000 --- a/example/src/test.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[test] -fn test() { - // let file = File::open("example/src/resources").expect("找不到文件"); - let file_name = "application.yml"; - let directories = vec!["src/resources", "spring-boot/src/resources", "dir3"]; - - for directory in directories { - let path = format!("{}/{}", directory, file_name); - let file_exists = std::fs::metadata(&path).is_ok(); - - if file_exists { - println!("文件 {} 存在于目录 {}", file_name, directory); - } else { - println!("文件 {} 不存在于目录 {}", file_name, directory); - } - } -} From 5e6f2136d7ed50c073f37b7dddc910d9faa43e03 Mon Sep 17 00:00:00 2001 From: jameszow Date: Wed, 27 Dec 2023 19:32:16 +0800 Subject: [PATCH 2/3] fetch: add test file in example module --- example/src/read_yml.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/example/src/read_yml.rs b/example/src/read_yml.rs index 0ee877a..54df35f 100644 --- a/example/src/read_yml.rs +++ b/example/src/read_yml.rs @@ -110,4 +110,22 @@ mod tests { println!("mysqlConfig:{}", serde_json::to_string(&a.mysql).unwrap()); }); } + + #[test] + fn load_env_file_test() { + // let file = File::open("example/src/resources").expect("找不到文件"); + let file_name = "application.yml"; + let directories = vec!["src/resources", "spring-boot/src/resources", "dir3"]; + + for directory in directories { + let path = format!("{}/{}", directory, file_name); + let file_exists = std::fs::metadata(&path).is_ok(); + + if file_exists { + println!("文件 {} 存在于目录 {}", file_name, directory); + } else { + println!("文件 {} 不存在于目录 {}", file_name, directory); + } + } + } } From 021b1fd01a55ea43475c152e1f8b4c5ea9562719 Mon Sep 17 00:00:00 2001 From: jameszow Date: Wed, 27 Dec 2023 19:32:51 +0800 Subject: [PATCH 3/3] fetch: fix add http_method and log in lib.rs --- example/src/http_method.rs | 4 ++-- example/src/lib.rs | 3 ++- example/src/main.rs | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/src/http_method.rs b/example/src/http_method.rs index d757c92..029834a 100644 --- a/example/src/http_method.rs +++ b/example/src/http_method.rs @@ -8,8 +8,8 @@ struct User { } #[summer_boot::get("/hello")] -pub async fn hello(mut _req: Request<()>) -> Result { - Ok(format!("Hello, Summer Boot").into()) +pub async fn hello(_req: Request<()>) -> Result { + Ok("Hello, Summer Boot".to_string().into()) } #[summer_boot::post("/user/getUserInfo")] diff --git a/example/src/lib.rs b/example/src/lib.rs index 8b13789..b9e7325 100644 --- a/example/src/lib.rs +++ b/example/src/lib.rs @@ -1 +1,2 @@ - +mod read_yml; +mod log; \ No newline at end of file diff --git a/example/src/main.rs b/example/src/main.rs index 6b74717..c768851 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -2,7 +2,6 @@ use serde::Deserialize; use summer_boot::{Request, Result}; mod http_method; -mod test; #[derive(Debug, Deserialize)] struct User {