1//! Fails when a committed notices file (`THIRD-PARTY`, 2//! `THIRD-PARTY-sidecar`) differs from what tools/third-party-notices 3//! writes from the crates linked into its binary. Fix with 4//! `buck2 run //tools/third-party-notices:update`. 5 6fn check(file: &str, committed: &str, generated: &str) { 7 let read = |var: &str| std::fs::read_to_string(std::env::var(var).unwrap()).unwrap(); 8 let (generated, committed) = (read(generated), read(committed)); 9 assert!( 10 generated == committed, 11 "{file} is out of date; run `buck2 run //tools/third-party-notices:update`.\n\ 12 --- expected ---\n{}", 13 generated.lines().take_while(|l| !l.starts_with("====")).collect::<Vec<_>>().join("\n") 14 ); 15} 16 17#[test] 18fn committed_notices_match_the_extensions_crates() { 19 check("THIRD-PARTY", "COMMITTED", "GENERATED"); 20} 21 22#[test] 23fn committed_notices_match_the_sidecars_crates() { 24 check("THIRD-PARTY-sidecar", "COMMITTED_SIDECAR", "GENERATED_SIDECAR"); 25}