From 1187f7d9b335431df336cb72b0dcabc72b35fc84 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Jan 2016 22:17:18 +0100 Subject: [PATCH] Add header verification test --- libimagstore/src/header.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libimagstore/src/header.rs b/libimagstore/src/header.rs index d068ae3b..5ab517c5 100644 --- a/libimagstore/src/header.rs +++ b/libimagstore/src/header.rs @@ -224,5 +224,22 @@ mod test { assert!(!has_imag_version_in_main_section(&map)); } + #[test] + fn test_verification_good() { + use super::verify_header_consistency; + + let mut header = BTreeMap::new(); + let sub = { + let mut sub = BTreeMap::new(); + sub.insert("version".into(), Value::String(String::from("0.0.0"))); + + Value::Table(sub) + }; + + header.insert("imag".into(), sub); + + assert!(verify_header_consistency(header).is_ok()); + } + }