(sandbox: &Path, golden: &[Golden], partial: bool, east: &[String])
| 557 | /// the east subtree and nothing else from the west or the root. |
| 558 | #[cfg(unix)] |
| 559 | fn verify(sandbox: &Path, golden: &[Golden], partial: bool, east: &[String]) -> Result<()> { |
| 560 | if partial { |
| 561 | for path in east { |
| 562 | let content = golden |
| 563 | .iter() |
| 564 | .find(|f| &f.path == path) |
| 565 | .context("east path missing from golden")?; |
| 566 | let target = sandbox.join(path); |
| 567 | ensure!(target.is_file(), "partial sandbox misses {}", path); |
| 568 | ensure!( |
| 569 | fs::read(&target)? == content.content, |
| 570 | "partial sandbox bytes differ: {path}" |
| 571 | ); |
| 572 | } |
| 573 | for file in golden { |
| 574 | if !east.contains(&file.path) { |
| 575 | ensure!( |
| 576 | !sandbox.join(&file.path).exists(), |
| 577 | "partial sandbox fetched beyond its prefix: {}", |
| 578 | file.path |
| 579 | ); |
| 580 | } |
| 581 | } |
| 582 | return Ok(()); |
| 583 | } |
| 584 | for file in golden { |
| 585 | let target = sandbox.join(&file.path); |
| 586 | ensure!(target.is_file(), "sandbox misses {}", file.path); |
| 587 | ensure!( |
| 588 | fs::read(&target)? == file.content, |
| 589 | "sandbox bytes differ: {}", |
| 590 | file.path |
| 591 | ); |
| 592 | ensure!( |
| 593 | file_mode(&target)? == 0o644 || file.content.is_empty(), |
| 594 | "sandbox mode differs: {}", |
| 595 | file.path |
| 596 | ); |
| 597 | } |
| 598 | Ok(()) |
| 599 | } |
| 600 | |
| 601 | // ————————————————————————————— harness ————————————————————————————— |
| 602 |
no test coverage detected