mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-03 11:58:04 +08:00
15 lines
255 B
Rust
Executable File
15 lines
255 B
Rust
Executable File
pub fn greeting(name: &str) -> String {
|
|
format!("Hello {}!", name)
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn greeting_contains_name() {
|
|
let result = greeting("Carol");
|
|
assert!(result.contains("Carol"));
|
|
}
|
|
}
|