From ef549d3b1988f598de9c81aee1ef650902bfac37 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 17:26:28 -0500 Subject: [PATCH] Compare quoted strings. --- src/wasm_test/compare.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 6ba9b7b..f156746 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -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, Box> { 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, ) -> Result, Box> { let mut result = WasmDiffResult::default(); + result.name = "plain-text".into(); if !is_plain_text(wasm) { result.status.push(WasmDiffStatus::Bad( format!(