diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 5d68d32a..dbd37661 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -714,7 +714,19 @@ fn compare_heading<'s>( (None, false) | (Some(_), true) => {} } - // TODO: Compare :pre-blank :raw-value :footnote-section-p :scheduled :closed + // Compare raw-value + let raw_value = get_property_quoted_string(emacs, ":raw-value")? + .ok_or("Headlines should have :raw-value.")?; + let rust_raw_value = rust.get_raw_value(); + if raw_value != rust_raw_value { + this_status = DiffStatus::Bad; + message = Some(format!( + "raw-value mismatch (emacs != rust) {:?} != {:?}", + raw_value, rust_raw_value + )); + } + + // TODO: Compare :pre-blank :footnote-section-p :scheduled :closed // // :scheduled and :closed seem to only appear when the headline has a planning diff --git a/src/types/document.rs b/src/types/document.rs index b5c9e97b..c271e8d8 100644 --- a/src/types/document.rs +++ b/src/types/document.rs @@ -74,3 +74,15 @@ impl<'s> StandardProperties<'s> for Heading<'s> { self.source } } + +impl<'s> Heading<'s> { + pub fn get_raw_value(&self) -> String { + // TODO: I think this could just return a string slice instead of an owned string. + let title_source: String = self + .title + .iter() + .map(|obj| obj.get_standard_properties().get_source()) + .collect(); + title_source + } +}