1#[cfg(feature="hello")]
2pub fn say_hello(name: &str) -> String {
3 format!("Hello, {}!", name)
4}
5
6#[cfg(feature="bye")]
7pub fn say_goodbye(name: &str) -> String {
8 format!("Good By, {}!", name)
9}
10
11#[cfg(feature="hello")]
12pub fn say_hello_to_everyone() -> String {
13 "Hello everyonen".to_string()
14}
15
16#[cfg(feature="bye")]
17pub fn say_goodbye_everyone() -> String {
18 "Goodby Everyone".to_string()
19}
20
21#[cfg(test)]
22mod tests {
23 use super::*;
24
25 #[test]
26 #[cfg(feature = "hello")]
27 fn test_say_hello() {
28 assert_eq!("Hello, Test!", say_hello("Test"));
29 }
30
31 #[test]
32 #[cfg(feature = "bye")]
33 fn test_say_goodbye() {
34 assert_eq!("Good By, Test!", say_goodbye("Test"));
35 }
36}