Compare quoted strings.

This commit is contained in:
Tom Alexander 2023-12-29 17:26:28 -05:00
parent 777c756a7f
commit ef549d3b19
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -309,6 +309,7 @@ fn compare_ast_node<'e, 's, 'w>(
{
// Compare children.
let mut layer = WasmDiffResult::default();
layer.name = "children".into();
if let Some(wasm_iter) = wasm
.get("children")
.map(|children| children.as_array())
@ -339,7 +340,17 @@ fn compare_quoted_string<'e, 's, 'w>(
wasm: &'w String,
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
let mut result = WasmDiffResult::default();
// TODO
let emacs_text = unquote(emacs)?;
if wasm.as_str() != emacs_text {
result.status.push(WasmDiffStatus::Bad(
format!(
"Text mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).",
emacs = emacs_text,
wasm = wasm,
)
.into(),
));
}
Ok(result)
}
@ -497,6 +508,7 @@ fn compare_plain_text<'e, 's, 'w>(
wasm: &'w serde_json::Map<String, serde_json::Value>,
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
let mut result = WasmDiffResult::default();
result.name = "plain-text".into();
if !is_plain_text(wasm) {
result.status.push(WasmDiffStatus::Bad(
format!(