mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
398 B
21 lines
398 B
pub fn greeting(name: &str) -> String {
|
|
String::from("Hello!")
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
// ANCHOR: here
|
|
#[test]
|
|
fn greeting_contains_name() {
|
|
let result = greeting("Carol");
|
|
assert!(
|
|
result.contains("Carol"),
|
|
"Greeting did not contain name, value was `{}`",
|
|
result
|
|
);
|
|
}
|
|
// ANCHOR_END: here
|
|
}
|