From 0d60d812c4dcf78a18dcc59325dc1ec609cf8eb8 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 12 Aug 2026 02:11:06 +0000 Subject: Distinguish initrd additions and removals --- tests/compare.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/compare.rs b/tests/compare.rs index 59b62cb..0853572 100644 --- a/tests/compare.rs +++ b/tests/compare.rs @@ -50,6 +50,33 @@ fn compares_added_removed_and_changed_semantic_records() { assert!(report.render().contains("changed initrd")); } +#[test] +fn distinguishes_added_and_removed_initrd_records() { + let without_initrd = ArtifactManifest::new(vec![], vec![], None, vec![], vec![]) + .expect("valid manifest without initrd"); + let with_initrd = ArtifactManifest::new( + vec![], + vec![], + Some(InitrdRecord::new("boot/initrd-rt.img", "digest")), + vec![], + vec![], + ) + .expect("valid manifest with initrd"); + + assert_eq!( + compare(&without_initrd, &with_initrd).differences(), + &[SemanticDifference::Initrd { + change: Change::Added + }] + ); + assert_eq!( + compare(&with_initrd, &without_initrd).differences(), + &[SemanticDifference::Initrd { + change: Change::Removed + }] + ); +} + #[test] fn reads_and_writes_a_toml_manifest_beside_an_artifact() { let fixture = tempdir().expect("temporary directory"); -- cgit v1.2.3