Support a no-op for headline pre-blank.
Some checks failed
clippy Build clippy has failed
rust-build Build rust-build has failed
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-test Build rust-test has failed

This commit is contained in:
Tom Alexander 2023-12-29 23:21:30 -05:00
parent c1b471208d
commit dd1f7c7777
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 25 additions and 5 deletions

View File

@ -37,9 +37,13 @@ pub struct WasmHeadline {
pub(crate) deadline: Option<Box<WasmAstNode>>,
pub(crate) closed: Option<Box<WasmAstNode>>,
#[serde(rename = "pre-blank")]
pub(crate) pre_blank: usize,
pub(crate) pre_blank: Noop,
}
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "noop")]
pub struct Noop {}
to_wasm!(
WasmHeadline,
Heading<'s>,
@ -129,7 +133,7 @@ to_wasm!(
})
.map_or(Ok(None), |r| r.map(Some))?
.map(|child| Box::new(child)),
pre_blank: 0, // TODO: Should this be a no-op?
pre_blank: Noop {},
},
))
}

View File

@ -8,6 +8,7 @@ use crate::compare::ElispFact;
use crate::types::CheckboxType;
use crate::types::PlainListItem;
use crate::types::PlainListItemCounter;
use crate::types::PlainListItemPreBlank;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
@ -17,7 +18,7 @@ pub struct WasmPlainListItem {
pub(crate) counter: Option<PlainListItemCounter>,
pub(crate) checkbox: Option<String>,
#[serde(rename = "pre-blank")]
pub(crate) pre_blank: usize,
pub(crate) pre_blank: PlainListItemPreBlank,
}
to_wasm!(
@ -52,7 +53,7 @@ to_wasm!(
}
.to_owned()
}),
pre_blank: 0, // TODO: Should this be a no-op?
pre_blank: original.pre_blank,
},
))
}

View File

@ -77,12 +77,27 @@ fn compare_json_value<'b, 's>(
(serde_json::Value::Number(w), Token::Atom(e)) if w.to_string().as_str() == (*e) => {
Ok(WasmDiffResult::default())
}
(serde_json::Value::Number(w), Token::Atom(e)) => {
let mut result = WasmDiffResult::default();
result.status.push(WasmDiffStatus::Bad(
format!(
"Value mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).",
emacs = e,
wasm = w,
)
.into(),
));
Ok(result)
}
(serde_json::Value::Array(w), Token::Atom("nil")) if w.is_empty() => {
Ok(WasmDiffResult::default())
}
(serde_json::Value::String(w), Token::Atom(e)) if w.as_str() == *e => {
Ok(WasmDiffResult::default())
}
(serde_json::Value::Object(w), Token::Atom(_)) if w.contains_key("noop") => {
Ok(WasmDiffResult::default())
}
(serde_json::Value::Null, Token::Atom(_)) => todo!(),
(serde_json::Value::Null, Token::List(_)) => todo!(),
(serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(),
@ -91,7 +106,7 @@ fn compare_json_value<'b, 's>(
(serde_json::Value::Bool(_), Token::List(_)) => todo!(),
(serde_json::Value::Bool(_), Token::TextWithProperties(_)) => todo!(),
(serde_json::Value::Bool(_), Token::Vector(_)) => todo!(),
(serde_json::Value::Number(_), Token::Atom(_)) => todo!(),
// (serde_json::Value::Number(_), Token::Atom(_)) => todo!(),
(serde_json::Value::Number(_), Token::List(_)) => todo!(),
(serde_json::Value::Number(_), Token::TextWithProperties(_)) => todo!(),
(serde_json::Value::Number(_), Token::Vector(_)) => todo!(),