From 7c471ab32e6189f387fa9695bba6bebe69b00079 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 6 Sep 2023 12:08:06 -0400 Subject: [PATCH] Compare keyword keys and values. --- src/compare/diff.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 704335d..a2f4117 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -1392,7 +1392,30 @@ fn compare_keyword<'s>( Ok(_) => {} }; - // TODO: Compare key and value + let key = unquote( + get_property(emacs, ":key")? + .ok_or("Emacs keywords should have a :key")? + .as_atom()?, + )?; + if key != rust.key.to_uppercase() { + this_status = DiffStatus::Bad; + message = Some(format!( + "Mismatchs keyword keys (emacs != rust) {:?} != {:?}", + key, rust.key + )) + } + let value = unquote( + get_property(emacs, ":value")? + .ok_or("Emacs keywords should have a :value")? + .as_atom()?, + )?; + if value != rust.value { + this_status = DiffStatus::Bad; + message = Some(format!( + "Mismatchs keyword values (emacs != rust) {:?} != {:?}", + value, rust.value + )) + } Ok(DiffResult { status: this_status,