Parse the babel call.
This commit is contained in:
@@ -2403,7 +2403,7 @@ fn compare_babel_call<'b, 's>(
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut message = None;
|
||||
|
||||
// TODO: Compare :call :inside-header :arguments :end-header
|
||||
// TODO: Compare :inside-header :end-header
|
||||
|
||||
// TODO: Compare :caption
|
||||
// Compare name
|
||||
@@ -2417,19 +2417,55 @@ fn compare_babel_call<'b, 's>(
|
||||
}
|
||||
|
||||
// Compare value
|
||||
let value = unquote(
|
||||
get_property(emacs, ":value")?
|
||||
.ok_or("Emacs keywords should have a :value")?
|
||||
.as_atom()?,
|
||||
)?;
|
||||
let value = get_property_quoted_string(emacs, ":value")?.unwrap_or(String::new());
|
||||
if value != rust.value {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Mismatchs keyword values (emacs != rust) {:?} != {:?}",
|
||||
"Value mismatch (emacs != rust) {:?} != {:?}",
|
||||
value, rust.value
|
||||
))
|
||||
}
|
||||
|
||||
// Compare call
|
||||
let call = get_property_quoted_string(emacs, ":call")?;
|
||||
if call.as_ref().map(String::as_str) != rust.call {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Call mismatch (emacs != rust) {:?} != {:?}",
|
||||
call, rust.call
|
||||
))
|
||||
}
|
||||
|
||||
// Compare arguments
|
||||
let arguments = get_property_quoted_string(emacs, ":arguments")?;
|
||||
if arguments.as_ref().map(String::as_str) != rust.arguments {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Arguments mismatch (emacs != rust) {:?} != {:?}",
|
||||
arguments, rust.arguments
|
||||
))
|
||||
}
|
||||
|
||||
// Compare inside header
|
||||
let inside_header = get_property_quoted_string(emacs, ":inside-header")?;
|
||||
if inside_header.as_ref().map(String::as_str) != rust.inside_header {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"Inside header mismatch (emacs != rust) {:?} != {:?}",
|
||||
inside_header, rust.inside_header
|
||||
))
|
||||
}
|
||||
|
||||
// Compare end header
|
||||
let end_header = get_property_quoted_string(emacs, ":end-header")?;
|
||||
if end_header.as_ref().map(String::as_str) != rust.end_header {
|
||||
this_status = DiffStatus::Bad;
|
||||
message = Some(format!(
|
||||
"End header mismatch (emacs != rust) {:?} != {:?}",
|
||||
end_header, rust.end_header
|
||||
))
|
||||
}
|
||||
|
||||
Ok(DiffResult {
|
||||
status: this_status,
|
||||
name: rust.get_elisp_name(),
|
||||
|
||||
Reference in New Issue
Block a user