flagon-io/hello

public

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

hello/src/lib.rs

26 lines468 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Greet people from the command line1//! Greetings.
2
3/// The greeting for `name`.
4pub fn greeting(name: &str) -> String {
5 format!("Hello, {name}!")
6}
7
Add a farewell8/// The farewell for `name`.
9pub fn farewell(name: &str) -> String {
10 format!("Goodbye {name}!")
11}
12
Greet people from the command line13#[cfg(test)]
14mod tests {
15 use super::*;
16
17 #[test]
Add a farewell18 fn says_goodbye_by_name() {
19 assert_eq!(farewell("Ada"), "Goodbye, Ada!");
20 }
21
22 #[test]
Greet people from the command line23 fn greets_by_name() {
24 assert_eq!(greeting("Ada"), "Hello, Ada!");
25 }
26}