Compare key and value.
This commit is contained in:
@@ -1301,10 +1301,33 @@ fn compare_node_property<'b, 's>(
|
||||
rust: &'b NodeProperty<'s>,
|
||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let this_status = DiffStatus::Good;
|
||||
let message = None;
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut message = None;
|
||||
|
||||
// TODO: Compare :key :value
|
||||
// Compare key
|
||||
let key =
|
||||
get_property_quoted_string(emacs, ":key")?.ok_or("Node properties should have a key.")?;
|
||||
if key != rust.name {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Key mismatch (emacs != rust) {:?} != {:?}",
|
||||
key, rust.name
|
||||
));
|
||||
}
|
||||
|
||||
// Compare value
|
||||
let value = get_property_quoted_string(emacs, ":value")?;
|
||||
match (value.as_ref(), rust.value) {
|
||||
(None, None) => {}
|
||||
(Some(emacs_value), Some(rust_value)) if emacs_value == rust_value => {}
|
||||
_ => {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Value mismatch (emacs != rust) {:?} != {:?}",
|
||||
value, rust.value
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(DiffResult {
|
||||
status: this_status,
|
||||
|
||||
Reference in New Issue
Block a user