xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/renamed_deps/mod2.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1*d4726bddSHONG Yifan extern crate mod1;
2*d4726bddSHONG Yifan 
greeter(name: &str) -> String3*d4726bddSHONG Yifan pub fn greeter(name: &str) -> String {
4*d4726bddSHONG Yifan     format!("Hello, {name}!")
5*d4726bddSHONG Yifan }
6*d4726bddSHONG Yifan 
default_greeter() -> String7*d4726bddSHONG Yifan pub fn default_greeter() -> String {
8*d4726bddSHONG Yifan     greeter(&mod1::world())
9*d4726bddSHONG Yifan }
10*d4726bddSHONG Yifan 
11*d4726bddSHONG Yifan #[cfg(test)]
12*d4726bddSHONG Yifan mod test {
13*d4726bddSHONG Yifan     #[test]
test_greeter()14*d4726bddSHONG Yifan     fn test_greeter() {
15*d4726bddSHONG Yifan         assert_eq!(super::greeter("Bob"), "Hello, Bob!");
16*d4726bddSHONG Yifan     }
17*d4726bddSHONG Yifan 
18*d4726bddSHONG Yifan     #[test]
test_default_greeter()19*d4726bddSHONG Yifan     fn test_default_greeter() {
20*d4726bddSHONG Yifan         assert_eq!(super::default_greeter(), "Hello, world!");
21*d4726bddSHONG Yifan     }
22*d4726bddSHONG Yifan }
23