Bubble up planning variables to the headline.
This commit is contained in:
@@ -719,9 +719,58 @@ fn compare_heading<'b, 's>(
|
||||
));
|
||||
}
|
||||
|
||||
// TODO: Compare :pre-blank :scheduled :closed
|
||||
//
|
||||
// :scheduled and :closed seem to only appear when the headline has a planning
|
||||
// Compare scheduled
|
||||
let scheduled = get_property(emacs, ":scheduled")?;
|
||||
match (scheduled, &rust.scheduled) {
|
||||
(None, None) => {}
|
||||
(None, Some(_)) | (Some(_), None) => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Scheduled mismatch (emacs != rust) {:?} != {:?}",
|
||||
scheduled, rust.scheduled
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("scheduled", vec![result])?);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare deadline
|
||||
let deadline = get_property(emacs, ":deadline")?;
|
||||
match (deadline, &rust.deadline) {
|
||||
(None, None) => {}
|
||||
(None, Some(_)) | (Some(_), None) => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Deadline mismatch (emacs != rust) {:?} != {:?}",
|
||||
deadline, rust.deadline
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("deadline", vec![result])?);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare closed
|
||||
let closed = get_property(emacs, ":closed")?;
|
||||
match (closed, &rust.closed) {
|
||||
(None, None) => {}
|
||||
(None, Some(_)) | (Some(_), None) => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Closed mismatch (emacs != rust) {:?} != {:?}",
|
||||
closed, rust.closed
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("closed", vec![result])?);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Compare :pre-blank
|
||||
|
||||
// Compare section
|
||||
let section_status = children
|
||||
@@ -1402,7 +1451,7 @@ fn compare_diary_sexp<'b, 's>(
|
||||
}
|
||||
|
||||
fn compare_planning<'b, 's>(
|
||||
_source: &'s str,
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
rust: &'b Planning<'s>,
|
||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
@@ -1422,7 +1471,7 @@ fn compare_planning<'b, 's>(
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(_source, emacs_child, rust_child.into())?;
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("scheduled", vec![result])?);
|
||||
}
|
||||
}
|
||||
@@ -1439,7 +1488,7 @@ fn compare_planning<'b, 's>(
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(_source, emacs_child, rust_child.into())?;
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("deadline", vec![result])?);
|
||||
}
|
||||
}
|
||||
@@ -1456,7 +1505,7 @@ fn compare_planning<'b, 's>(
|
||||
));
|
||||
}
|
||||
(Some(emacs_child), Some(rust_child)) => {
|
||||
let result = compare_ast_node(_source, emacs_child, rust_child.into())?;
|
||||
let result = compare_ast_node(source, emacs_child, rust_child.into())?;
|
||||
child_status.push(artificial_diff_scope("closed", vec![result])?);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user