xref: /aosp_15_r20/external/bazelbuild-rules_rust/test/unit/compile_data/compile_data.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 /// Data loaded from compile data
2 pub const COMPILE_DATA: &str = include_str!("compile_data.txt");
3 
4 #[cfg(test)]
5 mod test {
6     use super::*;
7 
8     /// A test that is expected to be compiled from a target that does not
9     /// directly populate the `compile_data` attribute
10     #[test]
test_compile_data_contents()11     fn test_compile_data_contents() {
12         assert_eq!(COMPILE_DATA.trim_end(), "compile data contents");
13     }
14 
15     /// An extra module that tests the `rust_test` rule wrapping the
16     /// `rust_library` is able to provide it's own compile data.
17     #[cfg(test_compile_data)]
18     mod test_compile_data {
19         const TEST_COMPILE_DATA: &str = include_str!("test_compile_data.txt");
20 
21         #[test]
test_compile_data_contents()22         fn test_compile_data_contents() {
23             assert_eq!(TEST_COMPILE_DATA.trim_end(), "test compile data contents");
24         }
25     }
26 }
27