flagon-io/hello

public

Greets people from the command line. The sample repository for g1t.

hello/src/lib.rs

26 lines468 bytesCodeBlame
1//! Greetings.
2
3/// The greeting for `name`.
4pub fn greeting(name: &str) -> String {
5 format!("Hello, {name}!")
6}
7
8/// The farewell for `name`.
9pub fn farewell(name: &str) -> String {
10 format!("Goodbye {name}!")
11}
12
13#[cfg(test)]
14mod tests {
15 use super::*;
16
17 #[test]
18 fn says_goodbye_by_name() {
19 assert_eq!(farewell("Ada"), "Goodbye, Ada!");
20 }
21
22 #[test]
23 fn greets_by_name() {
24 assert_eq!(greeting("Ada"), "Hello, Ada!");
25 }
26}