mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-04 04:28:04 +08:00
15 lines
255 B
Rust
15 lines
255 B
Rust
|
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"));
|
||
|
}
|
||
|
}
|