mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-04-19 19:28:06 +08:00
17 lines
287 B
Rust
17 lines
287 B
Rust
// ANCHOR: here
|
|
pub fn greeting(name: &str) -> String {
|
|
String::from("Hello!")
|
|
}
|
|
// ANCHOR_END: here
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn greeting_contains_name() {
|
|
let result = greeting("Carol");
|
|
assert!(result.contains("Carol"));
|
|
}
|
|
}
|