From fa31b001f463a150cb555780346c0bd922588b65 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 19:21:35 -0500 Subject: [PATCH] Implement fixed width area. --- src/wasm/fixed_width_area.rs | 13 +++++++++++-- src/wasm_test/compare.rs | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/wasm/fixed_width_area.rs b/src/wasm/fixed_width_area.rs index 8c29e8f0..049ae4e1 100644 --- a/src/wasm/fixed_width_area.rs +++ b/src/wasm/fixed_width_area.rs @@ -7,12 +7,14 @@ use super::to_wasm::ToWasm; use super::AdditionalProperties; use crate::compare::ElispFact; use crate::types::FixedWidthArea; +use crate::types::GetAffiliatedKeywords; use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize, Deserialize)] pub struct WasmFixedWidthArea { #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties, + pub(crate) value: String, } to_wasm!( @@ -21,12 +23,19 @@ to_wasm!( original, wasm_context, { WasmAstNode::FixedWidthArea(original) }, - { "TODO".into() }, + { "fixed-width".into() }, { + let additional_properties = original + .get_affiliated_keywords() + .to_wasm(wasm_context.clone())?; + + let value = original.get_value(); + Ok(( Vec::new(), WasmFixedWidthArea { - additional_properties: AdditionalProperties::default(), + additional_properties, + value, }, )) } diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 6169f75f..20de4eb9 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -57,6 +57,7 @@ fn compare_json_value<'b, 's>( (serde_json::Value::Object(w), Token::TextWithProperties(e)) if is_plain_text(w) => { compare_plain_text(source, e, w) } + (serde_json::Value::Null, Token::Atom("nil")) => Ok(WasmDiffResult::default()), (serde_json::Value::Null, Token::Atom(_)) => todo!(), (serde_json::Value::Null, Token::List(_)) => todo!(), (serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(), @@ -213,7 +214,7 @@ fn compare_ast_node<'e, 's, 'w>( (emacs_standard_properties.post_blank, "post-blank"), ] { match (emacs_value, wasm_standard_properties.get(wasm_name)) { - (None, None) => {} + (None, None) | (None, Some(serde_json::Value::Null)) => {} (None, Some(_)) => { layer.status.push(WasmDiffStatus::Bad( format!(