Compare radio link properties.
Some checks failed
rust-test Build rust-test has failed
rust-build Build rust-build has succeeded
rust-foreign-document-test Build rust-foreign-document-test has succeeded

This commit is contained in:
Tom Alexander
2023-10-07 00:57:55 -04:00
parent dfad7b7888
commit 8d621b32dc
4 changed files with 62 additions and 6 deletions

View File

@@ -2758,11 +2758,13 @@ fn compare_strike_through<'b, 's>(
}
fn compare_regular_link<'b, 's>(
_source: &'s str,
source: &'s str,
emacs: &'b Token<'s>,
rust: &'b RegularLink<'s>,
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
let children = emacs.as_list()?;
let mut this_status = DiffStatus::Good;
let mut child_status = Vec::new();
let mut message = None;
if let Some((new_status, new_message)) = compare_properties!(
@@ -2812,6 +2814,10 @@ fn compare_regular_link<'b, 's>(
message = new_message;
}
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())?);
}
Ok(DiffResult {
status: this_status,
name: rust.get_elisp_name(),
@@ -2824,14 +2830,56 @@ fn compare_regular_link<'b, 's>(
}
fn compare_radio_link<'b, 's>(
_source: &'s str,
source: &'s str,
emacs: &'b Token<'s>,
rust: &'b RadioLink<'s>,
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
let this_status = DiffStatus::Good;
let message = None;
let children = emacs.as_list()?;
let mut this_status = DiffStatus::Good;
let mut child_status = Vec::new();
let mut message = None;
// TODO: Compare :type :path :format :raw-link :application :search-option
if let Some((new_status, new_message)) = compare_properties!(
emacs,
rust,
(
EmacsField::Required(":type"),
|_| { Some("radio") },
compare_property_quoted_string
),
(
EmacsField::Required(":path"),
|r| Some(&r.path),
compare_property_quoted_string
),
(
EmacsField::Required(":format"),
|_| Some("plain"),
compare_property_unquoted_atom
),
(
EmacsField::Required(":raw-link"),
|r| Some(&r.raw_link),
compare_property_quoted_string
),
(
EmacsField::Required(":application"),
compare_identity,
compare_property_always_nil
),
(
EmacsField::Required(":search-option"),
compare_identity,
compare_property_always_nil
)
)? {
this_status = new_status;
message = new_message;
}
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())?);
}
Ok(DiffResult {
status: this_status,