diff options
Diffstat (limited to 'tests/compare.rs')
| -rw-r--r-- | tests/compare.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/compare.rs b/tests/compare.rs index 59b62cb..0853572 100644 --- a/tests/compare.rs +++ b/tests/compare.rs @@ -51,6 +51,33 @@ fn compares_added_removed_and_changed_semantic_records() { } #[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"); let artifact = fixture.path().join("controller.tar"); |