More of the test structure.

This commit is contained in:
Tom Alexander 2023-12-27 11:10:40 -05:00
parent 3cb251ea6c
commit 4984ea4179
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 82 additions and 2 deletions

View File

@ -62,6 +62,7 @@ mod underline;
mod verbatim; mod verbatim;
mod verse_block; mod verse_block;
pub use ast_node::WasmAstNode;
pub use document::WasmDocument; pub use document::WasmDocument;
pub use parse_result::wasm_parse_org; pub use parse_result::wasm_parse_org;
pub use parse_result::ParseResult; pub use parse_result::ParseResult;

View File

@ -1,12 +1,15 @@
use std::borrow::Cow; use std::borrow::Cow;
use crate::compare::Token; use crate::compare::Token;
use crate::wasm::WasmAstNode;
use crate::wasm::WasmDocument; use crate::wasm::WasmDocument;
pub fn wasm_compare_document<'b, 's>( pub fn wasm_compare_document<'b, 's>(
source: &'s str,
emacs: &'b Token<'s>, emacs: &'b Token<'s>,
wasm: &'b WasmDocument<'s>, wasm: WasmDocument<'s>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> { ) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
// wasm_compare_ast_node(
todo!() todo!()
} }
@ -81,3 +84,79 @@ impl<'b, 's> WasmDiffEntry<'b, 's> {
// } // }
} }
} }
fn wasm_compare_ast_node<'b, 's>(
source: &'s str,
emacs: &'b Token<'s>,
wasm: WasmAstNode<'s>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
match wasm {
WasmAstNode::Document(_) => todo!(),
WasmAstNode::Headline(_) => todo!(),
WasmAstNode::Section(_) => todo!(),
WasmAstNode::Paragraph(_) => todo!(),
WasmAstNode::PlainList(_) => todo!(),
WasmAstNode::PlainListItem(_) => todo!(),
WasmAstNode::CenterBlock(_) => todo!(),
WasmAstNode::QuoteBlock(_) => todo!(),
WasmAstNode::SpecialBlock(_) => todo!(),
WasmAstNode::DynamicBlock(_) => todo!(),
WasmAstNode::FootnoteDefinition(_) => todo!(),
WasmAstNode::Comment(_) => todo!(),
WasmAstNode::Drawer(_) => todo!(),
WasmAstNode::PropertyDrawer(_) => todo!(),
WasmAstNode::NodeProperty(_) => todo!(),
WasmAstNode::Table(_) => todo!(),
WasmAstNode::TableRow(_) => todo!(),
WasmAstNode::VerseBlock(_) => todo!(),
WasmAstNode::CommentBlock(_) => todo!(),
WasmAstNode::ExampleBlock(_) => todo!(),
WasmAstNode::ExportBlock(_) => todo!(),
WasmAstNode::SrcBlock(_) => todo!(),
WasmAstNode::Clock(_) => todo!(),
WasmAstNode::DiarySexp(_) => todo!(),
WasmAstNode::Planning(_) => todo!(),
WasmAstNode::FixedWidthArea(_) => todo!(),
WasmAstNode::HorizontalRule(_) => todo!(),
WasmAstNode::Keyword(_) => todo!(),
WasmAstNode::BabelCall(_) => todo!(),
WasmAstNode::LatexEnvironment(_) => todo!(),
WasmAstNode::Bold(_) => todo!(),
WasmAstNode::Italic(_) => todo!(),
WasmAstNode::Underline(_) => todo!(),
WasmAstNode::StrikeThrough(_) => todo!(),
WasmAstNode::Code(_) => todo!(),
WasmAstNode::Verbatim(_) => todo!(),
WasmAstNode::PlainText(_) => todo!(),
WasmAstNode::RegularLink(_) => todo!(),
WasmAstNode::RadioLink(_) => todo!(),
WasmAstNode::RadioTarget(_) => todo!(),
WasmAstNode::PlainLink(_) => todo!(),
WasmAstNode::AngleLink(_) => todo!(),
WasmAstNode::OrgMacro(_) => todo!(),
WasmAstNode::Entity(_) => todo!(),
WasmAstNode::LatexFragment(_) => todo!(),
WasmAstNode::ExportSnippet(_) => todo!(),
WasmAstNode::FootnoteReference(_) => todo!(),
WasmAstNode::Citation(_) => todo!(),
WasmAstNode::CitationReference(_) => todo!(),
WasmAstNode::InlineBabelCall(_) => todo!(),
WasmAstNode::InlineSourceBlock(_) => todo!(),
WasmAstNode::LineBreak(_) => todo!(),
WasmAstNode::Target(_) => todo!(),
WasmAstNode::StatisticsCookie(_) => todo!(),
WasmAstNode::Subscript(_) => todo!(),
WasmAstNode::Superscript(_) => todo!(),
WasmAstNode::TableCell(_) => todo!(),
WasmAstNode::Timestamp(_) => todo!(),
}
todo!()
}
fn impl_wasm_compare_document<'b, 's>(
source: &'s str,
emacs: &'b Token<'s>,
wasm: WasmDocument<'s>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
todo!()
}

View File

@ -42,7 +42,7 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
} }
// We do the diffing after printing out both parsed forms in case the diffing panics // We do the diffing after printing out both parsed forms in case the diffing panics
let diff_result = wasm_compare_document(&parsed_sexp, &wasm_parsed)?; let diff_result = wasm_compare_document(org_contents, &parsed_sexp, wasm_parsed)?;
if !silent { if !silent {
diff_result.print(org_contents)?; diff_result.print(org_contents)?;
} }