Compare the additional properties on headlines.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use super::compare_field::ComparePropertiesResult;
|
||||
use super::diff::DiffEntry;
|
||||
use super::diff::DiffStatus;
|
||||
use super::elisp_fact::GetElispFact;
|
||||
@@ -311,3 +312,28 @@ pub(crate) fn assert_no_children<'b, 's>(
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn compare_additional_properties<'b, 's, RK, RV, RI>(
|
||||
emacs: &'b Token<'s>,
|
||||
rust_children: RI,
|
||||
) -> Result<ComparePropertiesResult<'b, 's>, Box<dyn std::error::Error>>
|
||||
where
|
||||
RK: AsRef<str>,
|
||||
RV: AsRef<str>,
|
||||
RI: Iterator<Item = (RK, RV)> + ExactSizeIterator,
|
||||
{
|
||||
for (rust_key, rust_value) in rust_children {
|
||||
let rust_key = rust_key.as_ref();
|
||||
let rust_value = rust_value.as_ref();
|
||||
let emacs_value = get_property_quoted_string(emacs, rust_key)?;
|
||||
if Some(rust_value) != emacs_value.as_ref().map(String::as_str) {
|
||||
let this_status = DiffStatus::Bad;
|
||||
let message = Some(format!(
|
||||
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||
rust_key, emacs_value, rust_value
|
||||
));
|
||||
return Ok(ComparePropertiesResult::SelfChange(this_status, message));
|
||||
}
|
||||
}
|
||||
Ok(ComparePropertiesResult::NoChange)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user