From f011d15dd302fa017bf39e8b793945ac370e51fb Mon Sep 17 00:00:00 2001 From: wangmengc Date: Mon, 13 May 2024 10:49:28 +0800 Subject: [PATCH] add r_error --- utshell-0.5/Cargo.toml | 3 ++- utshell-0.5/r_error/Cargo.toml | 8 ++++++++ utshell-0.5/r_error/src/lib.rs | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 utshell-0.5/r_error/Cargo.toml create mode 100644 utshell-0.5/r_error/src/lib.rs diff --git a/utshell-0.5/Cargo.toml b/utshell-0.5/Cargo.toml index 49c15672..22fa0e8a 100644 --- a/utshell-0.5/Cargo.toml +++ b/utshell-0.5/Cargo.toml @@ -97,7 +97,7 @@ members=[ "r_bracecomp", "r_variables", "r_arrayfunc" -] +, "r_error"] [dependencies] libc = "*" @@ -173,5 +173,6 @@ members=[ r_array = {path = "./r_array"} r_bracecomp = {path = "./r_bracecomp"} r_variables = {path = "./r_variables"} + r_error = {path = "./r_error"} intl_pluralrules = "7.0.2" tinystr = "=0.7.1" diff --git a/utshell-0.5/r_error/Cargo.toml b/utshell-0.5/r_error/Cargo.toml new file mode 100644 index 00000000..f2532fe1 --- /dev/null +++ b/utshell-0.5/r_error/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "r_error" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/utshell-0.5/r_error/src/lib.rs b/utshell-0.5/r_error/src/lib.rs new file mode 100644 index 00000000..7d12d9af --- /dev/null +++ b/utshell-0.5/r_error/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} -- Gitee