Progress on comparing properties in the wasm_compare macro.
This commit is contained in:
@@ -15,7 +15,7 @@ macro_rules! wasm_compare {
|
||||
emacs_attributes_map.keys().map(|s| *s).collect();
|
||||
|
||||
{
|
||||
// Compare name
|
||||
// Compare name.
|
||||
let wasm_name = $wasm.get_elisp_name();
|
||||
|
||||
if emacs_name != wasm_name {
|
||||
@@ -31,7 +31,7 @@ macro_rules! wasm_compare {
|
||||
}
|
||||
|
||||
{
|
||||
// Compare children
|
||||
// Compare children.
|
||||
result.extend(wasm_compare_list(
|
||||
$source,
|
||||
emacs_list_iter,
|
||||
@@ -40,7 +40,7 @@ macro_rules! wasm_compare {
|
||||
}
|
||||
|
||||
{
|
||||
// Compare fields
|
||||
// Check for properties that are missing from the elisp node.
|
||||
$(
|
||||
match $emacs_field {
|
||||
EmacsField::Required(name) if emacs_keys.contains(name) => {
|
||||
@@ -63,6 +63,38 @@ macro_rules! wasm_compare {
|
||||
)*
|
||||
}
|
||||
|
||||
{
|
||||
// Check for elisp properties that were not compared.
|
||||
if !emacs_keys.is_empty() {
|
||||
let unexpected_keys: Vec<&str> = emacs_keys.into_iter().collect();
|
||||
let unexpected_keys = unexpected_keys.join(", ");
|
||||
result.status.push(WasmDiffStatus::Bad(
|
||||
format!(
|
||||
"Emacs node had extra field(s): ({field_names}).",
|
||||
field_names = unexpected_keys,
|
||||
)
|
||||
.into(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
// Compare properties.
|
||||
$(
|
||||
let emacs_name = match $emacs_field {
|
||||
EmacsField::Required(name) => {
|
||||
name
|
||||
},
|
||||
EmacsField::Optional(name) => {
|
||||
name
|
||||
},
|
||||
};
|
||||
let result = $compare_fn($source, $emacs, $wasm, emacs_name, $wasm_value_getter)?;
|
||||
// TODO: record this result.
|
||||
)*
|
||||
}
|
||||
|
||||
result
|
||||
}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user