xref: /aosp_15_r20/external/bazelbuild-rules_rust/examples/env_locations/main.rs (revision d4726bddaa87cc4778e7472feed243fa4b6c267f)
1 #[test]
test()2 fn test() {
3     // our source file should be readable
4     let source_file = std::fs::read_to_string(env!("SOURCE_FILE")).unwrap();
5     assert_eq!(source_file, "source\n");
6     // our generated data file should be readable at run time and build time
7     let generated_data = std::fs::read_to_string(env!("GENERATED_DATA_ROOT")).unwrap();
8     let generated_data2 = include_str!(env!("GENERATED_DATA_ABS"));
9     assert_eq!(generated_data, generated_data2);
10     // and we should be able to read (and thus execute) our tool
11     assert!(!std::fs::read(env!("SOME_TOOL")).unwrap().is_empty());
12 }
13