mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-25 19:39:03 +08:00
17 lines
287 B
Rust
Executable File
17 lines
287 B
Rust
Executable File
// 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"));
|
|
}
|
|
}
|