Compare name and parameters.
This commit is contained in:
parent
2352636672
commit
4a72747dc9
@ -1072,12 +1072,33 @@ fn compare_special_block<'b, 's>(
|
||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let this_status = DiffStatus::Good;
|
||||
let message = None;
|
||||
// TODO: Special block compare :type :parameters
|
||||
// Center and quote block has no additional properties
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut message = None;
|
||||
|
||||
let special_block_type = get_property_quoted_string(emacs, ":type")?;
|
||||
// Compare type
|
||||
let special_block_type =
|
||||
get_property_quoted_string(emacs, ":type")?.ok_or("Special blocks should have a name.")?;
|
||||
if special_block_type != rust.name {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Name mismatch (emacs != rust) {:?} != {:?}",
|
||||
special_block_type, rust.name
|
||||
));
|
||||
}
|
||||
|
||||
// Compare parameters
|
||||
let parameters = get_property_quoted_string(emacs, ":parameters")?;
|
||||
match (parameters.as_ref(), rust.parameters) {
|
||||
(None, None) => {}
|
||||
(Some(emacs_parameters), Some(rust_parameters)) if emacs_parameters == rust_parameters => {}
|
||||
_ => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Parameters mismatch (emacs != rust) {:?} != {:?}",
|
||||
parameters, rust.parameters
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
for (emacs_child, rust_child) in children.iter().skip(2).zip(rust.children.iter()) {
|
||||
child_status.push(compare_ast_node(source, emacs_child, rust_child.into())?);
|
||||
|
Loading…
x
Reference in New Issue
Block a user