From 4984ea4179ceea51e872c68652ca0b915fe8f282 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 27 Dec 2023 11:10:40 -0500 Subject: [PATCH] More of the test structure. --- src/wasm/mod.rs | 1 + src/wasm_test/compare.rs | 81 +++++++++++++++++++++++++++++++++++++++- src/wasm_test/runner.rs | 2 +- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index ed985d6..6690765 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -62,6 +62,7 @@ mod underline; mod verbatim; mod verse_block; +pub use ast_node::WasmAstNode; pub use document::WasmDocument; pub use parse_result::wasm_parse_org; pub use parse_result::ParseResult; diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index aaca966..82365b6 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -1,12 +1,15 @@ use std::borrow::Cow; use crate::compare::Token; +use crate::wasm::WasmAstNode; use crate::wasm::WasmDocument; pub fn wasm_compare_document<'b, 's>( + source: &'s str, emacs: &'b Token<'s>, - wasm: &'b WasmDocument<'s>, + wasm: WasmDocument<'s>, ) -> Result, Box> { + // wasm_compare_ast_node( 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, Box> { + 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, Box> { + todo!() +} diff --git a/src/wasm_test/runner.rs b/src/wasm_test/runner.rs index c5664a8..05c8d2a 100644 --- a/src/wasm_test/runner.rs +++ b/src/wasm_test/runner.rs @@ -42,7 +42,7 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef>( } // 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 { diff_result.print(org_contents)?; }