xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/chained_direct_deps/mod3.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 // This crate depends on 2 crates with one of them depending on the other one.
2 // If the crates are not set correctly in the dependency chain, this crate won't
3 // compile. The order of the `extern crate` is important to trigger that bug.
4 extern crate mod1;
5 extern crate mod2;
6 
greet(name: &str)7 pub fn greet(name: &str) {
8     println!("{}", mod2::greeter(name))
9 }
10 
greet_default()11 pub fn greet_default() {
12     println!("{}", mod2::default_greeter())
13 }
14 
15 /// This is a documentation.
16 ///
17 /// # Examples
18 ///
19 /// ```rust
20 /// assert!(
21 ///   mod3::am_i_the_world("world") == true
22 /// );
23 /// assert!(
24 ///   mod3::am_i_the_world("myself") == false
25 /// );
26 /// ```
am_i_the_world(me: &str) -> bool27 pub fn am_i_the_world(me: &str) -> bool {
28     me == mod1::world()
29 }
30 
31 #[cfg(test)]
32 mod test {
33     #[test]
test_am_i_the_world()34     fn test_am_i_the_world() {
35         assert!(super::am_i_the_world("world"));
36         assert!(!super::am_i_the_world("bob"));
37     }
38 }
39