From 7aa509ac107142010bedc576d58b6922f798260c Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 04:24:11 -0400 Subject: [PATCH 1/8] feat(test): replace print_tree with render_tree save a string and compare tests against it with insta --- .gitignore | 3 + README.org | 28 +++ crates/org-exporter/Cargo.toml | 1 + crates/org-exporter/src/html.rs | 2 +- crates/org-exporter/src/lib.rs | 11 ++ crates/org-exporter/src/org.rs | 17 +- crates/org-exporter/src/utils.rs | 3 +- crates/org-parser/Cargo.toml | 1 + crates/org-parser/src/element/block.rs | 7 +- crates/org-parser/src/element/drawer.rs | 5 +- crates/org-parser/src/element/heading.rs | 9 +- crates/org-parser/src/element/keyword.rs | 1 - crates/org-parser/src/element/latex_env.rs | 15 +- crates/org-parser/src/element/plain_list.rs | 35 ++-- crates/org-parser/src/element/table.rs | 23 +-- crates/org-parser/src/lib.rs | 24 ++- crates/org-parser/src/node_pool.rs | 5 - crates/org-parser/src/object/emoji.rs | 3 +- crates/org-parser/src/object/latex_frag.rs | 9 +- crates/org-parser/src/object/link.rs | 13 +- crates/org-parser/src/object/markup.rs | 29 +-- crates/org-parser/src/object/org_macro.rs | 3 +- crates/org-parser/src/object/sup_sub.rs | 3 +- crates/org-parser/src/render.rs | 92 +++++++++ crates/org-parser/src/test_util.rs | 30 +++ crates/org-parser/src/types.rs | 195 -------------------- 26 files changed, 274 insertions(+), 293 deletions(-) create mode 100644 crates/org-parser/src/render.rs create mode 100644 crates/org-parser/src/test_util.rs diff --git a/.gitignore b/.gitignore index ff3c111..482a610 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ pkg/aur/.SRCINFO # dummy dir to test org behaviour toss/ + +# don't commit pending snapshots +*.snap.new diff --git a/README.org b/README.org index c825d14..ef4dea0 100644 --- a/README.org +++ b/README.org @@ -45,3 +45,31 @@ cargo install org-rust *** Development Refer to the [[./docs][documentation]] for developer-specific information & syntax-progress. + + +** Testing + +The parser and exporter rely on snapshot tests built on [[https://insta.rs/][insta]]. +A parser test parses a small org input and compares ~Parser::render_tree()~ against a stored snapshot (~.snap~) in ~crates//snapshots/~. +Exporter tests snapshot the exported output instead. + +*** Snapshot workflow + +Run the tests as usual with ~cargo test --workspace~. +If a snapshot doesn't match (or doesn't exist yet), the test fails and ~insta~ writes the actual output next to it as a ~.snap.new~ file. + +Read the diff to verify correctness. Optionally, [[https://insta.rs/docs/cli/][cargo-insta]] offers a convenience tool for this: + +#+begin_src bash +cargo insta review +#+end_src + +If every change is intended, ~INSTA_UPDATE=always cargo test --workspace~ accepts them all at once, overwriting the stored snapshots without a diff. + +*** Adding a test + +The snapshot is named after the module path and test name, so names must be unique within a module. + +1. Run ~cargo test~. The new test fails and writes a ~.snap.new~. +2. Check, then accept it with ~cargo insta review~ / ~cargo insta accept~ or just do it manually. +3. Re-run ~cargo test~, then commit the new ~.snap~ file. diff --git a/crates/org-exporter/Cargo.toml b/crates/org-exporter/Cargo.toml index d05abc8..2a595b1 100644 --- a/crates/org-exporter/Cargo.toml +++ b/crates/org-exporter/Cargo.toml @@ -19,4 +19,5 @@ phf = {version = "0.11.1", features = ["macros"]} thiserror = "1.0.63" [dev-dependencies] +insta = "1.48.0" pretty_assertions = "1.3.0" diff --git a/crates/org-exporter/src/html.rs b/crates/org-exporter/src/html.rs index 82abefa..b111b52 100644 --- a/crates/org-exporter/src/html.rs +++ b/crates/org-exporter/src/html.rs @@ -1079,7 +1079,7 @@ abc &+ 10\\ \end{align} ", ); - println!("{a}"); + snap!(a); } #[test] diff --git a/crates/org-exporter/src/lib.rs b/crates/org-exporter/src/lib.rs index db19f59..7d7d8b0 100644 --- a/crates/org-exporter/src/lib.rs +++ b/crates/org-exporter/src/lib.rs @@ -31,6 +31,17 @@ //! assert_eq!(org_str, "* Hello Org!\n"); //! ``` +/// Asserts a value against its `insta` snapshot, stored in `/snapshots/`. +#[cfg(test)] +macro_rules! snap { + ($value:expr) => { + ::insta::with_settings!( + {snapshot_path => concat!(env!("CARGO_MANIFEST_DIR"), "/snapshots")}, + { ::insta::assert_snapshot!($value); } + ) + }; +} + mod html; mod include; mod org; diff --git a/crates/org-exporter/src/org.rs b/crates/org-exporter/src/org.rs index f487e3a..36dcdef 100644 --- a/crates/org-exporter/src/org.rs +++ b/crates/org-exporter/src/org.rs @@ -740,8 +740,8 @@ four five six #[test] fn test_link_export() { - let out = org_export("[[https://swag.org][meowww]]"); - println!("{out}"); + let out = org_export("[[https://swag.org][self]]"); + assert_eq!(out, "[[https://swag.org][self]]\n"); } #[test] @@ -880,7 +880,7 @@ more content here this is a pargraph ", ); - println!("{out}"); + snap!(out); } #[test] @@ -981,8 +981,6 @@ more content here this is a pargraph ", ); - println!("{a}"); - // TODO: whitespace handling is super janky atm. // can't even test output properly caudse whitespace is inserted into // blanklines, and emacs removes trailing whitespace @@ -1241,6 +1239,7 @@ more content here this is a pargraph } #[test] + #[ignore = "known bug: org exporter emits the src block body once per line (5x here)"] fn lblock_plus_list() { let a = org_export( r" @@ -1250,13 +1249,17 @@ more content here this is a pargraph hiiiiiiiiiiiiiiiiiii -meowwwwwwwwww +wow? #+end_src - ", ); - println!("{a}"); + assert_eq!( + a.matches("hiiiiiiiiiiiiiiiiiii").count(), + 1, + "src block body should be emitted once: {a:?}" + ); } #[test] diff --git a/crates/org-exporter/src/utils.rs b/crates/org-exporter/src/utils.rs index 87b9c3e..49199dc 100644 --- a/crates/org-exporter/src/utils.rs +++ b/crates/org-exporter/src/utils.rs @@ -152,7 +152,6 @@ mod tests { #[test] fn test_toc() -> Result<(), Box> { - //TODO: properly test let a = Html::export( r#" @@ -178,7 +177,7 @@ ul { ConfigOptions::default(), ) .unwrap(); - println!("{a}"); + snap!(a); Ok(()) } } diff --git a/crates/org-parser/Cargo.toml b/crates/org-parser/Cargo.toml index 48c02d8..2c80447 100644 --- a/crates/org-parser/Cargo.toml +++ b/crates/org-parser/Cargo.toml @@ -21,3 +21,4 @@ regex = "1.9.4" [dev-dependencies] pretty_assertions = "1.3.0" +insta = "1.48.0" diff --git a/crates/org-parser/src/element/block.rs b/crates/org-parser/src/element/block.rs index b965c4f..152c4fe 100644 --- a/crates/org-parser/src/element/block.rs +++ b/crates/org-parser/src/element/block.rs @@ -303,6 +303,7 @@ impl<'a> From> for &'a str { #[cfg(test)] mod tests { + use crate::test_util::snap; use std::collections::HashMap; use crate::element::Block; @@ -452,7 +453,7 @@ if let Some(nested) = nest { #+end_quote "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -514,7 +515,7 @@ here is some text "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -528,7 +529,7 @@ hiiiiiiiiiiiiiiiiiii "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/element/drawer.rs b/crates/org-parser/src/element/drawer.rs index 0855c77..7b1eaae 100644 --- a/crates/org-parser/src/element/drawer.rs +++ b/crates/org-parser/src/element/drawer.rs @@ -130,6 +130,7 @@ pub(crate) fn parse_property(mut cursor: Cursor) -> Result #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::parse_org; #[test] @@ -144,7 +145,7 @@ halloo "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -159,6 +160,6 @@ halloo "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } } diff --git a/crates/org-parser/src/element/heading.rs b/crates/org-parser/src/element/heading.rs index 29e05ca..59689e5 100644 --- a/crates/org-parser/src/element/heading.rs +++ b/crates/org-parser/src/element/heading.rs @@ -387,6 +387,7 @@ impl<'a> Heading<'a> { #[cfg(test)] mod tests { + use crate::test_util::snap; use std::borrow::Cow; use crate::element::{HeadingLevel, PropertyDrawer, Tag}; @@ -598,14 +599,14 @@ mod tests { fn headline_prio_keyword_title() { let inp = "* TODO [#A] SWAG \n"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn headline_prio_keyword_decorated_title() { let inp = "* TODO [#A] *one* two /three/ /four* \n"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -626,7 +627,7 @@ more subcontent "; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -671,7 +672,7 @@ qqqqq aaaa"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/element/keyword.rs b/crates/org-parser/src/element/keyword.rs index 76d3ba4..3e7139b 100644 --- a/crates/org-parser/src/element/keyword.rs +++ b/crates/org-parser/src/element/keyword.rs @@ -448,7 +448,6 @@ mod tests { &"yes_my_list".into() ); assert_eq!(parsed.target_occurences.get("yes_my_list").unwrap(), &1); - // parsed.print_tree(); } #[test] diff --git a/crates/org-parser/src/element/latex_env.rs b/crates/org-parser/src/element/latex_env.rs index 0ac4028..c91eddb 100644 --- a/crates/org-parser/src/element/latex_env.rs +++ b/crates/org-parser/src/element/latex_env.rs @@ -52,6 +52,7 @@ impl<'a> Parseable<'a> for LatexEnv<'a> { #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::{element::LatexEnv, expr_in_pool, parse_org, types::Expr}; #[test] @@ -61,7 +62,7 @@ mod tests { \end{align*} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -78,7 +79,7 @@ mod tests { \end{align*} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -89,19 +90,19 @@ mod tests { \end{star!} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); let inp = r" \begin{a13214-} \end{a13214-} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); // failed construction let inp = r" \begin{one}more stuff \end{one} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -110,7 +111,7 @@ mod tests { \begin{} \end{} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -119,7 +120,7 @@ mod tests { \begin{start} \end{notstart} "; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] diff --git a/crates/org-parser/src/element/plain_list.rs b/crates/org-parser/src/element/plain_list.rs index 65edfba..8a64557 100644 --- a/crates/org-parser/src/element/plain_list.rs +++ b/crates/org-parser/src/element/plain_list.rs @@ -97,6 +97,7 @@ fn find_kind(item: &Item) -> ListKind { #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::{Expr, parse_org}; #[test] @@ -106,7 +107,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -117,7 +118,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -129,7 +130,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -146,7 +147,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -162,7 +163,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -181,7 +182,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -198,7 +199,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -210,7 +211,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -223,7 +224,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -236,7 +237,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -250,7 +251,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -264,7 +265,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -276,7 +277,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -294,7 +295,7 @@ not a list too "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -306,7 +307,7 @@ not a list too a* "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -320,7 +321,7 @@ a* heyy "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -333,7 +334,7 @@ a* "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/element/table.rs b/crates/org-parser/src/element/table.rs index 337985b..9764ed0 100644 --- a/crates/org-parser/src/element/table.rs +++ b/crates/org-parser/src/element/table.rs @@ -138,6 +138,7 @@ impl<'a> Parseable<'a> for TableRow { #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::{Expr, element::Affiliated, expr_in_pool, parse_org}; #[test] @@ -148,7 +149,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -159,7 +160,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -169,7 +170,7 @@ mod tests { |three|four|"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -181,7 +182,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -194,7 +195,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -205,7 +206,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -216,7 +217,7 @@ mod tests { "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } /// test that alignment spaces are removed @@ -229,7 +230,7 @@ mod tests { let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -241,7 +242,7 @@ mod tests { let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -256,7 +257,7 @@ word "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -272,7 +273,7 @@ word let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/lib.rs b/crates/org-parser/src/lib.rs index 97ca79c..e37eed8 100644 --- a/crates/org-parser/src/lib.rs +++ b/crates/org-parser/src/lib.rs @@ -9,6 +9,10 @@ pub(crate) mod types; pub(crate) mod utils; mod parse; +mod render; + +#[cfg(test)] +pub(crate) mod test_util; pub use node_pool::{NodeID, NodePool}; pub use types::{Expr, Node, Parser}; @@ -111,13 +115,14 @@ pub fn parse_macro_call<'a>(input: &'a str) -> Parser<'a> { #[cfg(test)] mod tests { + use crate::test_util::snap; use super::*; #[test] fn test_basic_paragraph() { let inp = "hello_world\n"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -125,14 +130,14 @@ mod tests { fn test_basic_paragraph_no_nl() { let inp = "hello_world"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn test_basic_paragraph_newline() { let inp = "hello_world\nsame_paragraph\n"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -140,7 +145,7 @@ mod tests { let inp = "hello /italic/ more text after\n"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -148,7 +153,7 @@ mod tests { let inp = "hello /italic \n newline/ more text after\n"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -156,7 +161,7 @@ mod tests { let inp = "hello =italic \n newline= more text after\n"; // dbg!(parse_org(inp)); - println!("{:?}", parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -214,8 +219,7 @@ nothing styled for source blocks yet, too. "#; let pool = parse_org(input); - pool.print_tree(); - dbg!(pool); + snap!(pool); } #[test] @@ -228,7 +232,7 @@ nothing styled for source blocks yet, too. "; let pool = parse_org(input); // dbg!(&pool); - pool.print_tree(); + snap!(pool); } #[test] @@ -237,6 +241,6 @@ nothing styled for source blocks yet, too. "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } } diff --git a/crates/org-parser/src/node_pool.rs b/crates/org-parser/src/node_pool.rs index 0c6f6b6..8c05789 100644 --- a/crates/org-parser/src/node_pool.rs +++ b/crates/org-parser/src/node_pool.rs @@ -131,11 +131,6 @@ impl<'a> NodePool<'a> { self.inner_vec.iter_mut() } - /// Outputs a (somewhat) legible representation of the tree to stdout. - pub fn print_tree(&self) { - self.inner_vec[0].print_tree(self); - } - /// Returns the [`NodeID`] of the first element in the pool. pub fn root_id(&self) -> NodeID { NodeID(0) diff --git a/crates/org-parser/src/object/emoji.rs b/crates/org-parser/src/object/emoji.rs index 34fac5b..e20bdd6 100644 --- a/crates/org-parser/src/object/emoji.rs +++ b/crates/org-parser/src/object/emoji.rs @@ -1910,6 +1910,7 @@ pub(crate) fn parse_emoji<'a>(name: &'a str) -> Result> { #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::expr_in_pool; use crate::object::Emoji; use crate::parse_org; @@ -1938,7 +1939,7 @@ mod tests { "; let pool = parse_org(input); - dbg!(pool); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/object/latex_frag.rs b/crates/org-parser/src/object/latex_frag.rs index fbd8448..34f57b1 100644 --- a/crates/org-parser/src/object/latex_frag.rs +++ b/crates/org-parser/src/object/latex_frag.rs @@ -289,6 +289,7 @@ fn verify_single_char_latex_frag(cursor: Cursor) -> bool { #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::{expr_in_pool, object::LatexFragment, parse_org, types::Expr}; use pretty_assertions::assert_eq; @@ -402,7 +403,7 @@ mod tests { let input = r"\) not a command"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -462,7 +463,7 @@ c} "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -470,9 +471,7 @@ c} let input = "one two $three\nfourfive"; let pool = parse_org(input); - - dbg!(&pool); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/object/link.rs b/crates/org-parser/src/object/link.rs index 06d8662..44c8ae4 100644 --- a/crates/org-parser/src/object/link.rs +++ b/crates/org-parser/src/object/link.rs @@ -418,6 +418,7 @@ pub(crate) fn parse_angle_link<'a>( #[cfg(test)] mod tests { + use crate::test_util::snap; use pretty_assertions::assert_eq; use crate::element::Affiliated; @@ -537,7 +538,7 @@ mod tests { fn basic_regular_link() { let input = "[[hps://.org]]"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -547,28 +548,28 @@ word [#A] "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] fn regular_link_description() { let input = " [[https://meo][cool site]]"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] fn regular_link_unclosed_recursive_markup() { let input = " [[https://meo][cool *site* ~one two~ three *four ]]"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] fn regular_link_unclosed_plain_markup() { let input = " [[https://meo][cool *site* ~one two~ three *four ~five six ]]"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] @@ -581,7 +582,7 @@ I'll be skipping over the instrumentals unless there's reason to. "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/object/markup.rs b/crates/org-parser/src/object/markup.rs index c82415a..a78e265 100644 --- a/crates/org-parser/src/object/markup.rs +++ b/crates/org-parser/src/object/markup.rs @@ -143,44 +143,45 @@ plain_markup!(Verbatim, EQUAL); #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::parse_org; #[test] fn basic_verbatim() { let inp = "=hello_world="; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn basic_code() { let inp = "~hello_world~"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn basic_italic() { let inp = "/hello_world/"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn basic_bold() { let inp = "*hello_world*"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn basic_underline() { let inp = "_hello_world_"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] fn basic_strikethrough() { let inp = "+hello_world+"; - dbg!(parse_org(inp)); + snap!(parse_org(inp)); } #[test] @@ -188,7 +189,7 @@ mod tests { let inp = "**"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -196,7 +197,7 @@ mod tests { let inp = "~~"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -204,7 +205,7 @@ mod tests { let inp = "abc /one *two* three/ four"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -212,7 +213,7 @@ mod tests { let inp = "abc /one *two thr/ ee* three four"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -220,7 +221,7 @@ mod tests { let inp = "abc /one ~two thr/ ee~ three four"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } // #[test] // fn @@ -229,7 +230,7 @@ mod tests { let inp = "/"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -238,7 +239,7 @@ mod tests { let inp = "~a~"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } #[test] @@ -247,6 +248,6 @@ mod tests { let inp = "/a/"; let pool = parse_org(inp); - pool.print_tree(); + snap!(pool); } } diff --git a/crates/org-parser/src/object/org_macro.rs b/crates/org-parser/src/object/org_macro.rs index 00c719e..c2be300 100644 --- a/crates/org-parser/src/object/org_macro.rs +++ b/crates/org-parser/src/object/org_macro.rs @@ -150,6 +150,7 @@ impl<'a> Parseable<'a> for MacroCall<'a> { #[cfg(test)] mod tests { + use crate::test_util::snap; use std::borrow::Cow; use pretty_assertions::assert_eq; @@ -241,7 +242,7 @@ mod tests { {{{poem(cool, three)}}} "; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } #[test] diff --git a/crates/org-parser/src/object/sup_sub.rs b/crates/org-parser/src/object/sup_sub.rs index 9209a4d..750c749 100644 --- a/crates/org-parser/src/object/sup_sub.rs +++ b/crates/org-parser/src/object/sup_sub.rs @@ -126,6 +126,7 @@ parse_nscript!(Superscript); #[cfg(test)] mod tests { + use crate::test_util::snap; use crate::parse_org; #[test] @@ -133,6 +134,6 @@ mod tests { let input = r"a^{\smiley}"; let pool = parse_org(input); - pool.print_tree(); + snap!(pool); } } diff --git a/crates/org-parser/src/render.rs b/crates/org-parser/src/render.rs new file mode 100644 index 0000000..20f190c --- /dev/null +++ b/crates/org-parser/src/render.rs @@ -0,0 +1,92 @@ +//! Text rendering of a parsed document (primarily for testing/debugging). + +use std::collections::HashMap; +use std::fmt::{Debug, Write}; + +use crate::element::Affiliated; +use crate::node_pool::NodeID; +use crate::types::{Expr, Parser}; + +/// Every `NodeID` an expression owns, in source order. +fn child_ids(expr: &Expr) -> Vec { + let mut ids: Vec = Vec::new(); + if let Expr::Heading(h) = expr + && let Some((_, title)) = &h.title + { + ids.extend(title); + } + if let Some(children) = expr.children() { + ids.extend(children); + } + match expr { + Expr::RegularLink(l) => ids.extend(l.caption), + Expr::Affiliated(Affiliated::Name(id)) => ids.extend(id), + Expr::Affiliated(Affiliated::Caption(id)) => ids.push(*id), + Expr::Affiliated(Affiliated::Attr { child_id, .. }) => ids.extend(child_id), + _ => {} + } + ids +} + +fn render_node(parser: &Parser, id: NodeID, depth: usize, out: &mut String) { + let node = &parser.pool[id]; + // https://doc.rust-lang.org/std/fmt/#width for the indent trick + let _ = writeln!( + out, + "{:indent$}{}..{} {:?}", + "", + node.start, + node.end, + node.obj, + indent = depth * 2 + ); + for child in child_ids(&node.obj) { + render_node(parser, child, depth + 1, out); + } +} + +/// Writes `title:` followed by one `key sep value` line per entry, sorted by key so the +/// output doesn't depend on `HashMap` iteration order. Writes nothing for an empty map. +fn render_section(out: &mut String, title: &str, sep: &str, map: &HashMap<&str, V>) { + if map.is_empty() { + return; + } + let mut entries: Vec<_> = map.iter().collect(); + entries.sort_by_key(|(key, _)| **key); + let _ = writeln!(out, "{title}:"); + for (key, val) in entries { + let _ = writeln!(out, " {key:?} {sep} {val:?}"); + } +} + + +impl Parser<'_> { + /// Renders the parsed tree as indented text. + /// + /// Each line is one node: its span in the source (`start..end`) followed by its + /// contents, indented by depth. Child lists inside a node's contents show the + /// [`NodeID`]s of its children. Only nodes reachable from the root are shown. + /// + /// The tree is followed by the parser's `targets`, `keywords` and `macros` tables, each + /// under its own heading and sorted by key. A table with no entries is omitted. + /// + /// ```rust + /// use org_rust_parser as org_parser; + /// + /// let parsed = org_parser::parse_org("hello /world/\n"); + /// let tree = parsed.render_tree(); + /// + /// assert!(tree.contains("Italic")); + /// + /// let parsed = org_parser::parse_org("#+title: hi\n"); + /// assert!(parsed.render_tree().contains("keywords:\n \"title\" = \"hi\"")); + /// ``` + pub fn render_tree(&self) -> String { + let mut out = String::new(); + render_node(self, self.pool.root_id(), 0, &mut out); + render_section(&mut out, "targets", "->", &self.targets); + render_section(&mut out, "keywords", "=", &self.keywords); + render_section(&mut out, "macros", "=", &self.macros); + out + } +} diff --git a/crates/org-parser/src/test_util.rs b/crates/org-parser/src/test_util.rs new file mode 100644 index 0000000..7023d31 --- /dev/null +++ b/crates/org-parser/src/test_util.rs @@ -0,0 +1,30 @@ +//! Helpers for snapshot tests. +//! +//! [`snap!`] renders a parsed document with [`Parser::render_tree`] and hands it to +//! [`insta`], which compares it with a stored snapshot. Any change in structure fails the test with a diff. +//! +//! Snapshots are stored in `/snapshots/` refer to the README for more. + +use crate::types::Parser; + +/// Snapshots live in one directory at the crate root, not next to each source file. +pub(crate) const SNAPSHOT_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/snapshots"); + +/// The source text followed by the rendered tree, so a snapshot shows its own input. +pub(crate) fn snapshot_text(parser: &Parser) -> String { + format!("{:?}\n{}", parser.source, parser.render_tree()) +} + +/// Asserts that a parsed document matches its stored [`insta`] snapshot. +/// +/// The macro expands in the calling test, so `insta` names the snapshot after that test +/// and names it after that test's module path. +macro_rules! snap { + ($parser:expr) => {{ + let parser = &$parser; + ::insta::with_settings!({snapshot_path => $crate::test_util::SNAPSHOT_DIR}, { + ::insta::assert_snapshot!($crate::test_util::snapshot_text(parser)); + }); + }}; +} +pub(crate) use snap; diff --git a/crates/org-parser/src/types.rs b/crates/org-parser/src/types.rs index 39f3792..d0c01a7 100644 --- a/crates/org-parser/src/types.rs +++ b/crates/org-parser/src/types.rs @@ -169,10 +169,6 @@ impl<'a> Parser<'a> { target_id } - pub(crate) fn print_tree(&self) { - self.pool.print_tree(); - } - /// Creates a unique id based on the raw contents of the item /// use an Rc since the generated id will also be stored in the node /// and in target_occurences. @@ -422,10 +418,6 @@ impl<'a> Node<'a> { attrs: HashMap::new(), } } - - pub fn print_tree(&self, pool: &NodePool) { - self.obj.print_tree(pool); - } } /// An enum that represents all possible AST nodes @@ -643,193 +635,6 @@ impl<'a> Expr<'a> { _ => None, } } - - fn print_tree(&self, pool: &NodePool) { - match self { - Expr::LatexFragment(inner) => print!("{inner:#?}"), - Expr::Root(inner) => { - print!("Root("); - for id in inner { - // print!("{:#?}: ", id); - pool[*id].obj.print_tree(pool); - println!(); - } - print!(")"); - } - Expr::Heading(inner) => { - println!("Heading {{"); - println!("heading_level: {:#?}", inner.heading_level); - println!("keyword: {:#?}", inner.keyword); - println!("priority: {:#?}", inner.priority); - println!("tags: {:#?}", inner.tags); - println!("properties: {:#?}", inner.properties); - print!("title: "); - if let Some(title) = &inner.title { - for id in &title.1 { - pool[*id].obj.print_tree(pool); - } - } - println!(); - print!("children: ["); - if let Some(children) = &inner.children { - for id in children { - // print!("{:#?}: ", id); - pool[*id].obj.print_tree(pool); - print!(", "); - } - } - print!("]"); - print!("}}"); - } - Expr::Block(inner) => { - println!("Block{{"); - match inner { - Block::Center { contents, .. } - | Block::Quote { contents, .. } - | Block::Special { contents, .. } => { - for id in contents { - pool[*id].obj.print_tree(pool); - print!(","); - } - } - Block::Comment { contents, .. } - | Block::Example { contents, .. } - | Block::Export { contents, .. } - | Block::Src { contents, .. } - | Block::Verse { contents, .. } => { - println!("{contents:#?}"); - } - } - print!("\nEndBlock}}"); - } - Expr::RegularLink(inner) => { - println!("RegularLink{{"); - print!("{:#?}", inner.path); - if let Some(children) = &inner.description { - for id in children { - pool[*id].obj.print_tree(pool); - print!(","); - } - } - println!("}}"); - } - - Expr::Paragraph(inner) => { - print!("Paragraph {{"); - for id in &inner.0 { - // print!("{:#?}: ", id); - pool[*id].obj.print_tree(pool); - print!(", "); - } - print!("}}"); - } - - Expr::Italic(inner) => { - print!("Italic{{"); - for id in &inner.0 { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::Bold(inner) => { - print!("Bold{{"); - for id in &inner.0 { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::StrikeThrough(inner) => { - print!("StrikeThrough{{"); - for id in &inner.0 { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::Underline(inner) => { - print!("Underline{{"); - for id in &inner.0 { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::PlainList(inner) => { - print!("PlainList{{"); - for id in &inner.children { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::BlankLine => print!("BlankLine"), - Expr::SoftBreak => print!("SoftBreak"), - Expr::LineBreak => print!("LineBreak"), - Expr::HorizontalRule => print!("HorizontalRule"), - Expr::Plain(inner) => print!("{inner:#?}"), - Expr::Verbatim(inner) => print!("{inner:#?}"), - Expr::Code(inner) => print!("{inner:#?}"), - Expr::Comment(inner) => print!("{inner:#?}"), - Expr::InlineSrc(inner) => print!("{inner:#?}"), - Expr::Keyword(inner) => print!("{inner:#?}"), - Expr::LatexEnv(inner) => print!("{inner:#?}"), - Expr::Item(inner) => { - print!("Item{{"); - for id in &inner.children { - pool[*id].obj.print_tree(pool); - } - print!("}}"); - } - Expr::PlainLink(inner) => print!("{inner:#?}"), - Expr::Entity(inner) => print!("{inner:#?}"), - Expr::Table(inner) => { - println!("Table{{"); - for id in &inner.children { - pool[*id].obj.print_tree(pool); - } - print!("\n}}"); - dbg!(inner); - } - - Expr::TableRow(inner) => { - if let TableRow::Standard(stans) = inner { - print!("|"); - for id in stans { - pool[*id].obj.print_tree(pool); - } - } else { - print!("h-rule"); - } - - println!(); - } - Expr::TableCell(inner) => { - for id in &inner.0 { - pool[*id].obj.print_tree(pool); - } - print!("|"); - } - Expr::Emoji(inner) => print!("{inner:#?}"), - Expr::Superscript(inner) => print!("{inner:#?}"), - Expr::Subscript(inner) => print!("{inner:#?}"), - Expr::Target(inner) => print!("{inner:#?}"), - Expr::Macro(inner) => print!("{inner:#?}"), - Expr::Drawer(inner) => print!("{inner:#?}"), - Expr::ExportSnippet(inner) => print!("{inner:#?}"), - Expr::Affiliated(inner) => match inner { - Affiliated::Name(_) => print!("{inner:#?}"), - Affiliated::Caption(i1) => { - // pool[i1.unwrap()].obj.print_tree(pool); - pool[*i1].obj.print_tree(pool); - } - Affiliated::Attr { - child_id, - backend, - val, - } => print!("{inner:#?}"), - }, - Expr::MacroDef(inner) => print!("{inner:#?}"), - Expr::FootnoteDef(inner) => print!("{inner:#?}"), - Expr::FootnoteRef(inner) => print!("{inner:#?}"), - } - } } #[allow(clippy::format_in_format_args)] From 4b6d212fe1390b716e367c435d994356f759a380 Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 05:05:50 -0400 Subject: [PATCH 2/8] add snapshots --- ..._exporter__html__tests__correct_cache.snap | 11 ++ .../org_rust_exporter__org__tests__beeg.snap | 46 ++++++ ...rust_exporter__org__tests__list_words.snap | 12 ++ .../org_rust_exporter__utils__tests__toc.snap | 18 +++ ...ock__tests__big_greater_block_content.snap | 37 +++++ ...ement__block__tests__gblock_plus_list.snap | 15 ++ ..._block__tests__greater_block_indented.snap | 11 ++ ..._element__drawer__tests__basic_drawer.snap | 15 ++ ...ent__drawer__tests__basic_drawer_caps.snap | 15 ++ ...__heading__tests__headline_everything.snap | 42 ++++++ ...headline_prio_keyword_decorated_title.snap | 16 +++ ...g__tests__headline_prio_keyword_title.snap | 10 ++ ...r__element__heading__tests__tag_parse.snap | 16 +++ ...nt__latex_env__tests__basic_latex_env.snap | 11 ++ ...__latex_env__tests__latex_empty_start.snap | 9 ++ ...env__tests__latex_env_failed_header-2.snap | 11 ++ ...env__tests__latex_env_failed_header-3.snap | 12 ++ ...x_env__tests__latex_env_failed_header.snap | 11 ++ ...ex_env__tests__latex_env_with_content.snap | 22 +++ ...t__latex_env__tests__latex_failed_end.snap | 11 ++ ...lement__plain_list__tests__basic_list.snap | 11 ++ ...lement__plain_list__tests__blank_list.snap | 27 ++++ ...ent__plain_list__tests__combined_list.snap | 16 +++ ...__plain_list__tests__indent_list_prop.snap | 22 +++ ..._list__tests__list_contained_elements.snap | 22 +++ ...lain_list__tests__list_continued_item.snap | 16 +++ ...t__tests__list_elements_breaking_flow.snap | 26 ++++ ...lement__plain_list__tests__list_empty.snap | 12 ++ ..._list__tests__list_inconsistent_types.snap | 30 ++++ ..._tests__list_no_item_with_sub_element.snap | 19 +++ ...lain_list__tests__list_numbered_empty.snap | 12 ++ ..._plain_list__tests__list_space_ending.snap | 28 ++++ ...nt__plain_list__tests__list_two_items.snap | 14 ++ ...ent__plain_list__tests__nested_list_2.snap | 26 ++++ ...ent__plain_list__tests__nested_list_3.snap | 25 ++++ ...ent__plain_list__tests__nested_list_4.snap | 18 +++ ...plain_list__tests__nested_lists_basic.snap | 18 +++ ...r__element__table__tests__basic_table.snap | 18 +++ ...nt__table__tests__table_aligned_cells.snap | 17 +++ ...ment__table__tests__table_empty_cells.snap | 16 +++ ...r__element__table__tests__table_eof_1.snap | 18 +++ ...r__element__table__tests__table_eof_2.snap | 18 +++ ...element__table__tests__table_indented.snap | 27 ++++ ...nt__table__tests__table_indented_list.snap | 33 +++++ ...element__table__tests__table_markup_1.snap | 20 +++ ...r__element__table__tests__table_no_nl.snap | 19 +++ ...ment__table__tests__table_uneven_cols.snap | 21 +++ ...ement__table__tests__table_with_hrule.snap | 20 +++ ...r__object__emoji__tests__failed_emoji.snap | 8 ++ ...ct__latex_frag__tests__latex_frag_all.snap | 29 ++++ ...tex_frag__tests__latex_frag_command_4.snap | 8 ++ ...latex_frag__tests__latex_frag_pretext.snap | 10 ++ ...ject__link__tests__basic_regular_link.snap | 8 ++ ...arser__object__link__tests__file_link.snap | 16 +++ ...link__tests__regular_link_description.snap | 9 ++ ...__link__tests__regular_link_malformed.snap | 11 ++ ...s__regular_link_unclosed_plain_markup.snap | 15 ++ ...egular_link_unclosed_recursive_markup.snap | 15 ++ ...er__object__markup__tests__basic_bold.snap | 10 ++ ...er__object__markup__tests__basic_code.snap | 8 ++ ...__object__markup__tests__basic_italic.snap | 10 ++ ...t__markup__tests__basic_strikethrough.snap | 10 ++ ...bject__markup__tests__basic_underline.snap | 9 ++ ...object__markup__tests__basic_verbatim.snap | 8 ++ ...__object__markup__tests__leaky_markup.snap | 12 ++ ...markup__tests__markup_not_fail_on_eof.snap | 8 ++ ...ct__markup__tests__markup_plain_empty.snap | 8 ++ ...rkup__tests__markup_plain_single_char.snap | 8 ++ ...markup__tests__markup_recursive_empty.snap | 8 ++ ...__tests__markup_recursive_single_char.snap | 9 ++ ...s__mixed_plain_recursive_leaky_markup.snap | 11 ++ ..._object__markup__tests__nested_markup.snap | 14 ++ ...ct__org_macro__tests__combined_macros.snap | 12 ++ ...er__object__sup_sub__tests__basic_sup.snap | 10 ++ .../org_rust_parser__tests__basic_markup.snap | 11 ++ ...g_rust_parser__tests__basic_paragraph.snap | 9 ++ ...arser__tests__basic_paragraph_newline.snap | 12 ++ ..._parser__tests__basic_paragraph_no_nl.snap | 8 ++ ...org_rust_parser__tests__basic_unicode.snap | 8 ++ ...rust_parser__tests__correctness_cache.snap | 15 ++ .../org_rust_parser__tests__lots.snap | 131 ++++++++++++++++++ ...rser__tests__newline_in_italic_markup.snap | 13 ++ ...st_parser__tests__newline_in_verbatim.snap | 10 ++ 83 files changed, 1421 insertions(+) create mode 100644 crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap create mode 100644 crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap create mode 100644 crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap create mode 100644 crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__lots.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap create mode 100644 crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap diff --git a/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap b/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap new file mode 100644 index 0000000..7ab018e --- /dev/null +++ b/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-exporter/src/html.rs +expression: a +--- +
    +
  • one

    +
  • +
  • two

    +
  • +
+abc+10 diff --git a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap new file mode 100644 index 0000000..e29baf6 --- /dev/null +++ b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap @@ -0,0 +1,46 @@ +--- +source: crates/org-exporter/src/org.rs +expression: out +--- +* DONE [#0] *one* two /three/ /four* :one:two:three:four: +more content here this is a pargraph +** [#1] descendant headline :five: +*** [#2] inherit the tags +** [#3] different level +subcontent this more content here this is a pargraph +** [#1] descendant headline :five: +*** [#2] inherit the tags +** [#3] different level +subcontent this + +is a different paragraph id) = more subcontent + +* [#4] separate andy +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + +is a different paragraph id) = more subcontent + +* [#4] separate andy +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph +** [#1] descendant headline :five: +*** [#2] inherit the tags +** [#3] different level +subcontent this + +is a different paragraph id) = more subcontent + +* [#4] separate andy +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph +** [#1] descendant headline :five: +*** [#2] inherit the tags +** [#3] different level +subcontent this + +is a different paragraph id) = more subcontent + +* [#4] separate andy +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph +** a +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph +* a +more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph diff --git a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap new file mode 100644 index 0000000..6b41cc3 --- /dev/null +++ b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-exporter/src/org.rs +expression: stripped +--- + +1. item 1 abcdef + + next one two three four five + + more thangs more thangs more thangs more thangs +2. [X] item 2 + - aome tag :: item 2.1 diff --git a/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap b/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap new file mode 100644 index 0000000..0249c36 --- /dev/null +++ b/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-exporter/src/utils.rs +expression: a +--- + + + +

swag

+

abc

+

love

+

3

diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap new file mode 100644 index 0000000..d14d6a7 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap @@ -0,0 +1,37 @@ +--- +source: crates/org-parser/src/element/block.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n#+begin_quote\n\n/formatted text? such thing!/\n*abc*\n\n* headlines too\nanything is possible\n\nblank lines\n\n#+keyword: one\n\n#+begin_src rust\nlet nest = Some()\n\nif let Some(nested) = nest {\n dbg!(meta);\n}\n\n#+end_src\n\n** headline :tag:meow:\n#+end_quote\n" +0..250 [1, 2, 26] + 0..1 BlankLine + 1..249 Quote { parameters: {}, contents: [3, 4, 10, 11] } + 15..16 BlankLine + 16..52 Paragraph([6, 7, 9]) + 16..45 Italic([5]) + 17..44 "formatted text? such thing!" + 45..46 SoftBreak + 46..51 Bold([8]) + 47..50 "abc" + 52..53 BlankLine + 53..238 Heading { heading_level: One, keyword: None, priority: None, title: Some(("headlines too\n", [12])), tags: None, properties: None, children: Some([13, 14, 16, 17, 19, 20, 21, 22, 23, 24]) } + 55..68 "headlines too" + 69..90 Paragraph([15]) + 69..89 "anything is possible" + 90..91 BlankLine + 91..103 Paragraph([18]) + 91..102 "blank lines" + 103..104 BlankLine + 104..119 Keyword { key: "keyword", val: "one" } + 119..120 BlankLine + 120..213 Src { language: Some("rust"), parameters: {}, contents: "let nest = Some()\n\nif let Some(nested) = nest {\n dbg!(meta);\n}\n\n" } + 213..214 BlankLine + 214..215 BlankLine + 215..238 Heading { heading_level: Two, keyword: None, priority: None, title: Some(("headline", [25])), tags: Some([Raw("meow"), Raw("tag"), Loc(11)]), properties: None, children: None } + 218..226 "headline" + 249..250 BlankLine +targets: + "headline" -> "headline" + "headlines too\n" -> "headlines-too" +keywords: + "keyword" = "one" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap new file mode 100644 index 0000000..7748dec --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/element/block.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- a\n #+begin_quote\nhiiiiiiiiiiiiiiiiiii\n #+end_quote\n-\n" +0..60 [1, 10] + 0..1 BlankLine + 1..60 PlainList { children: [2, 9], kind: Unordered } + 1..58 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 4] } + 3..5 Paragraph([7]) + 3..4 "a" + 8..57 Quote { parameters: {}, contents: [5] } + 22..43 Paragraph([6]) + 22..42 "hiiiiiiiiiiiiiiiiiii" + 58..60 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap new file mode 100644 index 0000000..57fdf3b --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/block.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n #+begin_swag\n we are eating so good?\n #+end_swag\n" +0..87 [1, 2, 5] + 0..1 BlankLine + 14..86 Special { parameters: {}, contents: [3], name: "swag" } + 40..63 Paragraph([4]) + 40..62 "we are eating so good?" + 86..87 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap new file mode 100644 index 0000000..cdada12 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/element/drawer.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\n:NAME:\nhello\n:end:\n\nhalloo\n" +0..29 [1, 2, 3, 6, 7, 8] + 0..1 BlankLine + 1..2 BlankLine + 2..20 Drawer { children: [4], name: "NAME" } + 9..15 Paragraph([5]) + 9..14 "hello" + 20..21 BlankLine + 21..22 BlankLine + 22..29 Paragraph([9]) + 22..28 "halloo" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap new file mode 100644 index 0000000..afd6d05 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/element/drawer.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\n:NAME:\nhello\n:END:\n\nhalloo\n" +0..29 [1, 2, 3, 6, 7, 8] + 0..1 BlankLine + 1..2 BlankLine + 2..20 Drawer { children: [4], name: "NAME" } + 9..15 Paragraph([5]) + 9..14 "hello" + 20..21 BlankLine + 21..22 BlankLine + 22..29 Paragraph([9]) + 22..28 "halloo" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap new file mode 100644 index 0000000..de9507c --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap @@ -0,0 +1,42 @@ +--- +source: crates/org-parser/src/element/heading.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"* DONE [#0] *one* two /three/ /four* :one:two:three:four:\nmore content here this is a pargraph\n** [#1] descendant headline :five:\n*** [#2] inherit the tags\n** [#3] different level\nsubcontent\nthis\n\nis a different paragraph\nid) =\nmore subcontent\n\n* [#4] separate andy\n" +0..272 [1, 28] + 0..251 Heading { heading_level: One, keyword: Some("DONE"), priority: Some(Num(0)), title: Some(("*one* two /three/ /four*", [3, 6, 5, 8, 7])), tags: Some([Raw("four"), Raw("three"), Raw("two"), Raw("one")]), properties: None, children: Some([9, 10, 14]) } + 12..17 Bold([2]) + 13..16 "one" + 17..22 " two " + 22..29 Italic([4]) + 23..28 "three" + 29..31 " /" + 31..36 "four*" + 64..101 Paragraph([30]) + 64..100 "more content here this is a pargraph" + 101..162 Heading { heading_level: Two, keyword: None, priority: Some(Num(1)), title: Some(("descendant headline", [11])), tags: Some([Raw("five"), Loc(1)]), properties: None, children: Some([12]) } + 109..128 "descendant headline" + 136..162 Heading { heading_level: Three, keyword: None, priority: Some(Num(2)), title: Some(("inherit the tags\n", [13])), tags: Some([Loc(10)]), properties: None, children: None } + 145..161 "inherit the tags" + 162..251 Heading { heading_level: Two, keyword: None, priority: Some(Num(3)), title: Some(("different level\n", [15])), tags: Some([Loc(1)]), properties: None, children: Some([16, 19, 21, 26]) } + 170..185 "different level" + 186..202 Paragraph([18, 17, 20]) + 186..196 "subcontent" + 196..197 SoftBreak + 197..201 "this" + 202..203 BlankLine + 203..250 Paragraph([23, 22, 25, 24, 27]) + 203..227 "is a different paragraph" + 227..228 SoftBreak + 228..233 "id) =" + 233..234 SoftBreak + 234..249 "more subcontent" + 250..251 BlankLine + 251..272 Heading { heading_level: One, keyword: None, priority: Some(Num(4)), title: Some(("separate andy\n", [29])), tags: None, properties: None, children: None } + 258..271 "separate andy" +targets: + "*one* two /three/ /four*" -> "one-two-three-four" + "descendant headline" -> "descendant-headline" + "different level\n" -> "different-level" + "inherit the tags\n" -> "inherit-the-tags" + "separate andy\n" -> "separate-andy" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap new file mode 100644 index 0000000..7745375 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/element/heading.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"* TODO [#A] *one* two /three/ /four* \n" +0..38 [1] + 0..38 Heading { heading_level: One, keyword: Some("TODO"), priority: Some(A), title: Some(("*one* two /three/ /four* \n", [3, 6, 5, 8, 7])), tags: None, properties: None, children: None } + 12..17 Bold([2]) + 13..16 "one" + 17..22 " two " + 22..29 Italic([4]) + 23..28 "three" + 29..31 " /" + 31..37 "four* " +targets: + "*one* two /three/ /four* \n" -> "one-two-three-four-" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap new file mode 100644 index 0000000..9c33482 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/element/heading.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"* TODO [#A] SWAG \n" +0..18 [1] + 0..18 Heading { heading_level: One, keyword: Some("TODO"), priority: Some(A), title: Some(("SWAG \n", [2])), tags: None, properties: None, children: None } + 12..17 "SWAG " +targets: + "SWAG \n" -> "swag-" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap new file mode 100644 index 0000000..ec6de15 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/element/heading.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n* q ac:qbc:\nqqqqq\n\naaaa" +0..25 [1, 2] + 0..1 BlankLine + 1..25 Heading { heading_level: One, keyword: None, priority: None, title: Some(("q ac:qbc:\n", [3])), tags: None, properties: None, children: Some([4, 5, 7]) } + 3..12 "q ac:qbc:" + 13..19 Paragraph([6]) + 13..18 "qqqqq" + 19..20 BlankLine + 20..25 Paragraph([8]) + 20..24 "aaaa" +targets: + "q ac:qbc:\n" -> "q-acqbc" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap new file mode 100644 index 0000000..a369726 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{align*}\n\\end{align*}\n" +0..29 [1, 2] + 0..1 BlankLine + 1..29 Paragraph([3, 4, 5]) + 1..15 Command { name: "begin", contents: Some("align*") } + 15..16 SoftBreak + 16..28 Command { name: "end", contents: Some("align*") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap new file mode 100644 index 0000000..fa10183 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap @@ -0,0 +1,9 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{}\n\\end{}\n" +0..17 [1, 2, 3] + 0..1 BlankLine + 1..16 LatexEnv { name: "", contents: "" } + 16..17 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap new file mode 100644 index 0000000..092a4eb --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{a13214-}\n\\end{a13214-}\n" +0..31 [1, 2] + 0..1 BlankLine + 1..31 Paragraph([3, 4, 5]) + 1..16 Command { name: "begin", contents: Some("a13214-") } + 16..17 SoftBreak + 17..30 Command { name: "end", contents: Some("a13214-") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap new file mode 100644 index 0000000..9136bcc --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{one}more stuff\n\\end{one}\n" +0..33 [1, 2] + 0..1 BlankLine + 1..33 Paragraph([3, 5, 4, 6]) + 1..12 Command { name: "begin", contents: Some("one") } + 12..22 "more stuff" + 22..23 SoftBreak + 23..32 Command { name: "end", contents: Some("one") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap new file mode 100644 index 0000000..31d166a --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{star!}\n\\end{star!}\n" +0..27 [1, 2] + 0..1 BlankLine + 1..27 Paragraph([3, 4, 5]) + 1..14 Command { name: "begin", contents: Some("star!") } + 14..15 SoftBreak + 15..26 Command { name: "end", contents: Some("star!") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap new file mode 100644 index 0000000..fea616c --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap @@ -0,0 +1,22 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{align*}\n\n\\text{latex constructs}\\\\\n\\alpha\\\\\n\\beta\\\\\n\n10x + 4 &= 3\\\\\n\n\\end{align*}\n" +0..90 [1, 2, 4, 5] + 0..1 BlankLine + 1..16 Paragraph([3]) + 1..15 Command { name: "begin", contents: Some("align*") } + 16..17 BlankLine + 17..90 Paragraph([6, 7, 8, 9, 10, 11, 12, 14, 13, 15, 16]) + 17..40 Command { name: "text", contents: Some("latex constructs") } + 40..43 LineBreak + 43..49 Entity { name: "alpha", mapped_item: "α" } + 49..52 LineBreak + 52..57 Entity { name: "beta", mapped_item: "β" } + 57..60 LineBreak + 60..61 SoftBreak + 61..73 "10x + 4 &= 3" + 73..76 LineBreak + 76..77 SoftBreak + 77..89 Command { name: "end", contents: Some("align*") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap new file mode 100644 index 0000000..c3b0061 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/latex_env.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n\\begin{start}\n\\end{notstart}\n" +0..30 [1, 2] + 0..1 BlankLine + 1..30 Paragraph([3, 4, 5]) + 1..14 Command { name: "begin", contents: Some("start") } + 14..15 SoftBreak + 15..29 Command { name: "end", contents: Some("notstart") } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap new file mode 100644 index 0000000..2664baf --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n" +0..7 [1, 5] + 0..1 BlankLine + 1..7 PlainList { children: [2], kind: Unordered } + 1..7 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..7 Paragraph([4]) + 3..6 "one" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap new file mode 100644 index 0000000..a6a1790 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap @@ -0,0 +1,27 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"1. item 1\n abcdef\n\n next one two three four five\n\n more thangs more thangs more thangs\n more thangs\n\n2. [X] item 2\n - aome tag :: item 2.1\n" +0..149 [22] + 0..149 PlainList { children: [1, 15], kind: Ordered(Number(1)) } + 0..109 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [2, 5, 7, 8, 10] } + 3..20 Paragraph([4, 3, 6]) + 3..9 "item 1" + 9..10 SoftBreak + 10..19 " abcdef" + 20..21 BlankLine + 24..53 Paragraph([9]) + 24..52 "next one two three four five" + 53..54 BlankLine + 57..108 Paragraph([12, 11, 14]) + 57..92 "more thangs more thangs more thangs" + 92..93 SoftBreak + 93..107 " more thangs" + 109..149 Item { bullet: Ordered(Number(2)), counter_set: None, check_box: Some(On), tag: None, children: [16, 20] } + 116..123 Paragraph([21]) + 116..122 "item 2" + 126..149 PlainList { children: [17], kind: Descriptive } + 126..149 Item { bullet: Unordered, counter_set: None, check_box: None, tag: Some("aome tag"), children: [18] } + 140..149 Paragraph([19]) + 140..148 "item 2.1" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap new file mode 100644 index 0000000..61eee1b --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- zero\n- one\n\na*\n" +0..18 [1, 9, 10] + 0..1 BlankLine + 1..15 PlainList { children: [2, 4], kind: Unordered } + 1..8 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..8 Paragraph([8]) + 3..7 "zero" + 8..15 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5] } + 10..14 Paragraph([7]) + 10..13 "one" + 15..18 Paragraph([11]) + 15..17 "a*" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap new file mode 100644 index 0000000..b6bf954 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap @@ -0,0 +1,22 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n- two\n - qq\n\n\n heyy\n" +0..28 [1, 14, 8, 10, 15] + 0..1 BlankLine + 1..20 PlainList { children: [2, 4], kind: Unordered } + 1..7 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..7 Paragraph([13]) + 3..6 "one" + 7..20 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5, 11] } + 9..13 Paragraph([12]) + 9..12 "two" + 15..20 PlainList { children: [6], kind: Unordered } + 15..20 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 17..20 Paragraph([9]) + 17..19 "qq" + 20..21 BlankLine + 21..22 BlankLine + 23..28 Paragraph([16]) + 23..27 "heyy" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap new file mode 100644 index 0000000..1a07084 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap @@ -0,0 +1,22 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n abcd\n eif\n #+begin_example\n we are eating so good?\n #+end_example\n\n- two\n" +0..94 [1, 12, 10, 11, 16] + 0..1 BlankLine + 1..86 PlainList { children: [2], kind: Unordered } + 1..86 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 8] } + 3..28 Paragraph([5, 4, 7, 6, 9]) + 3..6 "one" + 6..7 SoftBreak + 7..17 " abcd" + 17..18 SoftBreak + 18..27 " eif" + 30..86 Example { parameters: {}, contents: " we are eating so good?\n" } + 86..87 BlankLine + 87..88 BlankLine + 88..94 PlainList { children: [13], kind: Unordered } + 88..94 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [14] } + 90..94 Paragraph([15]) + 90..93 "two" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap new file mode 100644 index 0000000..672d76f --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n abcdef\n- two\n" +0..21 [1, 10] + 0..1 BlankLine + 1..21 PlainList { children: [2, 6], kind: Unordered } + 1..15 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..15 Paragraph([5, 4, 9]) + 3..6 "one" + 6..7 SoftBreak + 7..14 " abcdef" + 15..21 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 17..21 Paragraph([8]) + 17..20 "two" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap new file mode 100644 index 0000000..b274eac --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap @@ -0,0 +1,26 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n abcdef\n- four\nthis aint a list baby\n#+begin_src python\nnot a list too\n#+end_src\n\n\n- five\n" +0..97 [1, 10, 11, 12, 14, 15, 16, 20] + 0..1 BlankLine + 1..22 PlainList { children: [2, 6], kind: Unordered } + 1..15 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..15 Paragraph([5, 4, 9]) + 3..6 "one" + 6..7 SoftBreak + 7..14 " abcdef" + 15..22 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 17..22 Paragraph([8]) + 17..21 "four" + 22..44 Paragraph([13]) + 22..43 "this aint a list baby" + 44..87 Src { language: Some("python"), parameters: {}, contents: "not a list too\n" } + 87..88 BlankLine + 88..89 BlankLine + 89..90 BlankLine + 90..97 PlainList { children: [17], kind: Unordered } + 90..97 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [18] } + 92..97 Paragraph([19]) + 92..96 "five" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap new file mode 100644 index 0000000..f7a9842 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n-\n-\n-\n-\n" +0..9 [1, 6] + 0..1 BlankLine + 1..9 PlainList { children: [2, 3, 4, 5], kind: Unordered } + 1..3 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } + 3..5 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } + 5..7 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } + 7..9 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap new file mode 100644 index 0000000..fa25f7d --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap @@ -0,0 +1,30 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n abcdef\n1. two\n2. three\n3. four\n- five\n- six\n" +0..52 [1, 22, 24, 26] + 0..1 BlankLine + 1..15 PlainList { children: [2], kind: Unordered } + 1..15 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..15 Paragraph([5, 4, 21]) + 3..6 "one" + 6..7 SoftBreak + 7..14 " abcdef" + 15..39 PlainList { children: [23, 8, 10], kind: Ordered(Number(1)) } + 15..22 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [7] } + 18..22 Paragraph([20]) + 18..21 "two" + 22..31 Item { bullet: Ordered(Number(2)), counter_set: None, check_box: None, tag: None, children: [9] } + 25..31 Paragraph([19]) + 25..30 "three" + 31..39 Item { bullet: Ordered(Number(3)), counter_set: None, check_box: None, tag: None, children: [11] } + 34..39 Paragraph([18]) + 34..38 "four" + 39..52 PlainList { children: [25, 14], kind: Unordered } + 39..46 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [13] } + 41..46 Paragraph([17]) + 41..45 "five" + 46..52 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [15] } + 48..52 Paragraph([16]) + 48..51 "six" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap new file mode 100644 index 0000000..7760fdb --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap @@ -0,0 +1,19 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"- [X]\n |a|a|a|a|\n\n-\n\n" +0..28 [15] + 0..28 PlainList { children: [1, 13], kind: Unordered } + 0..25 Item { bullet: Unordered, counter_set: None, check_box: Some(On), tag: None, children: [2] } + 14..24 Table { rows: 1, cols: 4, children: [11], caption: None } + 14..24 Standard([4, 6, 8, 10]) + 15..17 TableCell([3]) + 15..16 "a" + 17..19 TableCell([5]) + 17..18 "a" + 19..21 TableCell([7]) + 19..20 "a" + 21..23 TableCell([9]) + 21..22 "a" + 25..28 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap new file mode 100644 index 0000000..97d2294 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n1.\n2.\n3.\n4.\n" +0..13 [1, 6] + 0..1 BlankLine + 1..13 PlainList { children: [2, 3, 4, 5], kind: Ordered(Number(1)) } + 1..4 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [] } + 4..7 Item { bullet: Ordered(Number(2)), counter_set: None, check_box: None, tag: None, children: [] } + 7..10 Item { bullet: Ordered(Number(3)), counter_set: None, check_box: None, tag: None, children: [] } + 10..13 Item { bullet: Ordered(Number(4)), counter_set: None, check_box: None, tag: None, children: [] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap new file mode 100644 index 0000000..e5a3cc0 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap @@ -0,0 +1,28 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n abcdef\n- two\n- three\n- four\n\n\n- five\n" +0..45 [1, 18, 12, 14, 22] + 0..1 BlankLine + 1..36 PlainList { children: [2, 6, 8, 10], kind: Unordered } + 1..15 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..15 Paragraph([5, 4, 17]) + 3..6 "one" + 6..7 SoftBreak + 7..14 " abcdef" + 15..21 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 17..21 Paragraph([16]) + 17..20 "two" + 21..29 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [9] } + 23..29 Paragraph([15]) + 23..28 "three" + 29..36 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [11] } + 31..36 Paragraph([13]) + 31..35 "four" + 36..37 BlankLine + 37..38 BlankLine + 38..45 PlainList { children: [19], kind: Unordered } + 38..45 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [20] } + 40..45 Paragraph([21]) + 40..44 "five" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap new file mode 100644 index 0000000..d8809a5 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap @@ -0,0 +1,14 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n- two\n" +0..13 [1, 8] + 0..1 BlankLine + 1..13 PlainList { children: [2, 4], kind: Unordered } + 1..7 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..7 Paragraph([7]) + 3..6 "one" + 7..13 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5] } + 9..13 Paragraph([6]) + 9..12 "two" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap new file mode 100644 index 0000000..74a5cfd --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap @@ -0,0 +1,26 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n - two\n - three\n - four\n- five\n" +0..44 [1, 20] + 0..1 BlankLine + 1..44 PlainList { children: [2, 17], kind: Unordered } + 1..37 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 15] } + 3..7 Paragraph([16]) + 3..6 "one" + 9..37 PlainList { children: [4], kind: Unordered } + 9..37 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5, 9, 14] } + 11..15 Paragraph([10]) + 11..14 "two" + 19..27 PlainList { children: [6], kind: Unordered } + 19..27 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 21..27 Paragraph([8]) + 21..26 "three" + 30..37 PlainList { children: [11], kind: Unordered } + 30..37 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [12] } + 32..37 Paragraph([13]) + 32..36 "four" + 37..44 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [18] } + 39..44 Paragraph([19]) + 39..43 "five" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap new file mode 100644 index 0000000..539450e --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap @@ -0,0 +1,25 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n - two\n - three\n - four\n- five\n" +0..43 [1, 19] + 0..1 BlankLine + 1..43 PlainList { children: [2, 16], kind: Unordered } + 1..36 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 14] } + 3..7 Paragraph([15]) + 3..6 "one" + 9..36 PlainList { children: [4, 11], kind: Unordered } + 9..27 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5, 9] } + 11..15 Paragraph([10]) + 11..14 "two" + 19..27 PlainList { children: [6], kind: Unordered } + 19..27 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [7] } + 21..27 Paragraph([8]) + 21..26 "three" + 29..36 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [12] } + 31..36 Paragraph([13]) + 31..35 "four" + 36..43 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [17] } + 38..43 Paragraph([18]) + 38..42 "five" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap new file mode 100644 index 0000000..431abd9 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n1. item 1\n2. [X] item 2\n - some tag :: item 2.1\n" +0..51 [1, 12] + 0..1 BlankLine + 1..51 PlainList { children: [2, 4], kind: Ordered(Number(1)) } + 1..11 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [3] } + 4..11 Paragraph([11]) + 4..10 "item 1" + 11..51 Item { bullet: Ordered(Number(2)), counter_set: None, check_box: Some(On), tag: None, children: [5, 9] } + 18..25 Paragraph([10]) + 18..24 "item 2" + 28..51 PlainList { children: [6], kind: Descriptive } + 28..51 Item { bullet: Unordered, counter_set: None, check_box: None, tag: Some("some tag"), children: [7] } + 42..51 Paragraph([8]) + 42..50 "item 2.1" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap new file mode 100644 index 0000000..81d76e1 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-parser/src/element/plain_list.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n - two\n- three\n" +0..22 [1, 12] + 0..1 BlankLine + 1..22 PlainList { children: [2, 9], kind: Unordered } + 1..14 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 7] } + 3..7 Paragraph([8]) + 3..6 "one" + 8..14 PlainList { children: [4], kind: Unordered } + 8..14 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5] } + 10..14 Paragraph([6]) + 10..13 "two" + 14..22 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [10] } + 16..22 Paragraph([11]) + 16..21 "three" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap new file mode 100644 index 0000000..ca040a9 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|two|\n|three|four|\n" +0..24 [1, 2] + 0..1 BlankLine + 1..24 Table { rows: 2, cols: 2, children: [7, 12], caption: None } + 1..11 Standard([4, 6]) + 2..6 TableCell([3]) + 2..5 "one" + 6..10 TableCell([5]) + 6..9 "two" + 11..24 Standard([9, 11]) + 12..18 TableCell([8]) + 12..17 "three" + 18..23 TableCell([10]) + 18..22 "four" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap new file mode 100644 index 0000000..893bd57 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap @@ -0,0 +1,17 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one two |three|\n|s | |\n" +0..35 [1, 2] + 0..1 BlankLine + 1..35 Table { rows: 2, cols: 2, children: [7, 12], caption: None } + 1..18 Standard([4, 6]) + 2..11 TableCell([3]) + 2..10 "one two" + 11..17 TableCell([5]) + 11..16 "three" + 18..35 Standard([9, 11]) + 19..28 TableCell([8]) + 19..27 "s" + 28..34 TableCell([]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap new file mode 100644 index 0000000..3a1fec4 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n||a|\n|b||\n" +0..11 [1, 2] + 0..1 BlankLine + 1..11 Table { rows: 2, cols: 2, children: [6, 10], caption: None } + 1..6 Standard([3, 5]) + 2..3 TableCell([]) + 3..5 TableCell([4]) + 3..4 "a" + 6..11 Standard([8, 9]) + 7..9 TableCell([7]) + 7..8 "b" + 9..10 TableCell([]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap new file mode 100644 index 0000000..ca040a9 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|two|\n|three|four|\n" +0..24 [1, 2] + 0..1 BlankLine + 1..24 Table { rows: 2, cols: 2, children: [7, 12], caption: None } + 1..11 Standard([4, 6]) + 2..6 TableCell([3]) + 2..5 "one" + 6..10 TableCell([5]) + 6..9 "two" + 11..24 Standard([9, 11]) + 12..18 TableCell([8]) + 12..17 "three" + 18..23 TableCell([10]) + 18..22 "four" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap new file mode 100644 index 0000000..f5dbd83 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap @@ -0,0 +1,18 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|two|\n|three|four|" +0..23 [1, 2] + 0..1 BlankLine + 1..23 Table { rows: 2, cols: 2, children: [7, 12], caption: None } + 1..11 Standard([4, 6]) + 2..6 TableCell([3]) + 2..5 "one" + 6..10 TableCell([5]) + 6..9 "two" + 11..23 Standard([9, 11]) + 12..18 TableCell([8]) + 12..17 "three" + 18..23 TableCell([10]) + 18..22 "four" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap new file mode 100644 index 0000000..4404cf7 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap @@ -0,0 +1,27 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\nword\n |one two |three|\n |s | |\n |four | five|\nword\n\n" +0..84 [1, 2, 3, 20, 21] + 0..1 BlankLine + 1..6 Paragraph([19]) + 1..5 "word" + 14..78 Table { rows: 3, cols: 2, children: [8, 13, 18], caption: None } + 14..31 Standard([5, 7]) + 15..24 TableCell([4]) + 15..23 "one two" + 24..30 TableCell([6]) + 24..29 "three" + 31..56 Standard([10, 12]) + 40..49 TableCell([9]) + 40..48 "s" + 49..55 TableCell([]) + 56..78 Standard([15, 17]) + 65..71 TableCell([14]) + 65..70 "four" + 71..77 TableCell([16]) + 71..76 " five" + 78..83 Paragraph([22]) + 78..82 "word" + 83..84 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap new file mode 100644 index 0000000..25904c2 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap @@ -0,0 +1,33 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n - two\n |one two |three|\n |s | |\n |four | five|\n- three\n" +0..96 [1, 28] + 0..1 BlankLine + 1..96 PlainList { children: [2, 25], kind: Unordered } + 1..88 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3, 23] } + 3..7 Paragraph([24]) + 3..6 "one" + 10..88 PlainList { children: [4], kind: Unordered } + 10..88 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5, 6] } + 12..16 Paragraph([22]) + 12..15 "two" + 24..88 Table { rows: 3, cols: 2, children: [11, 16, 21], caption: None } + 24..41 Standard([8, 10]) + 25..34 TableCell([7]) + 25..33 "one two" + 34..40 TableCell([9]) + 34..39 "three" + 41..66 Standard([13, 15]) + 50..59 TableCell([12]) + 50..58 "s" + 59..65 TableCell([]) + 66..88 Standard([18, 20]) + 75..81 TableCell([17]) + 75..80 "four" + 81..87 TableCell([19]) + 81..86 " five" + 88..96 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [26] } + 90..96 Paragraph([27]) + 90..95 "three" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap new file mode 100644 index 0000000..90297ca --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap @@ -0,0 +1,20 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|tw *o* |\n|three|four|\n" +0..65 [1, 2] + 0..1 BlankLine + 1..65 Table { rows: 2, cols: 2, children: [10, 15], caption: None } + 1..52 Standard([4, 9]) + 2..6 TableCell([3]) + 2..5 "one" + 6..51 TableCell([7, 6]) + 6..9 "tw " + 9..12 Bold([5]) + 10..11 "o" + 52..65 Standard([12, 14]) + 53..59 TableCell([11]) + 53..58 "three" + 59..64 TableCell([13]) + 59..63 "four" diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap new file mode 100644 index 0000000..655eb12 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap @@ -0,0 +1,19 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|two\n|three|four\n\n" +0..23 [1, 2, 13] + 0..1 BlankLine + 1..22 Table { rows: 2, cols: 2, children: [7, 12], caption: None } + 1..10 Standard([4, 6]) + 2..6 TableCell([3]) + 2..5 "one" + 6..9 TableCell([5]) + 6..9 "two" + 10..22 Standard([9, 11]) + 11..17 TableCell([8]) + 11..16 "three" + 17..21 TableCell([10]) + 17..21 "four" + 22..23 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap new file mode 100644 index 0000000..39d0f7b --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap @@ -0,0 +1,21 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one two |three|||||\n|s | |\n" +0..39 [1, 2] + 0..1 BlankLine + 1..39 Table { rows: 2, cols: 6, children: [11, 16], caption: None } + 1..22 Standard([4, 6, 7, 8, 9, 10]) + 2..11 TableCell([3]) + 2..10 "one two" + 11..17 TableCell([5]) + 11..16 "three" + 17..18 TableCell([]) + 18..19 TableCell([]) + 19..20 TableCell([]) + 20..21 TableCell([]) + 22..39 Standard([13, 15]) + 23..32 TableCell([12]) + 23..31 "s" + 32..38 TableCell([]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap new file mode 100644 index 0000000..ee4c2e0 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap @@ -0,0 +1,20 @@ +--- +source: crates/org-parser/src/element/table.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n|one|two\n|--------|\n|three|four\n\n" +0..34 [1, 2, 14] + 0..1 BlankLine + 1..33 Table { rows: 3, cols: 2, children: [7, 8, 13], caption: None } + 1..10 Standard([4, 6]) + 2..6 TableCell([3]) + 2..5 "one" + 6..9 TableCell([5]) + 6..9 "two" + 10..21 Rule + 21..33 Standard([10, 12]) + 22..28 TableCell([9]) + 22..27 "three" + 28..32 TableCell([11]) + 28..32 "four" + 33..34 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap b/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap new file mode 100644 index 0000000..0e2008c --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/emoji.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +":flu shed: abc\n" +0..16 [1] + 0..16 Paragraph([2]) + 0..15 ":flu shed: abc" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap new file mode 100644 index 0000000..705e631 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap @@ -0,0 +1,29 @@ +--- +source: crates/org-parser/src/object/latex_frag.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n$\\alpha$ $$do\nllar$$\n\\[display\n block\\] \\(consecutive gaming\\)\n\n\\command\n\n\\comma\nand\n\n\\command{ab\nc}\n\n" +0..103 [1, 2, 10, 11, 13, 14, 17, 19, 22] + 0..1 BlankLine + 1..64 Paragraph([3, 5, 4, 6, 7, 9, 8]) + 1..9 Inline("\\alpha") + 9..10 " " + 10..21 Display("do\nllar") + 21..22 SoftBreak + 22..40 Display("display\n block") + 40..41 " " + 41..63 Inline("consecutive gaming") + 64..65 BlankLine + 65..74 Paragraph([12]) + 65..73 Command { name: "command", contents: None } + 74..75 BlankLine + 75..86 Paragraph([15, 16, 18]) + 75..81 Command { name: "comma", contents: None } + 81..82 SoftBreak + 82..85 "and" + 86..87 BlankLine + 87..102 Paragraph([21, 20, 23]) + 87..98 "\\command{ab" + 98..99 SoftBreak + 99..101 "c}" + 102..103 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap new file mode 100644 index 0000000..0ce5354 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/latex_frag.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\\) not a command" +0..17 [1] + 0..17 Paragraph([2]) + 0..16 "\\) not a command" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap new file mode 100644 index 0000000..a7a1437 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/object/latex_frag.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"one two $three\nfourfive" +0..24 [1] + 0..24 Paragraph([3, 2, 4]) + 0..14 "one two $three" + 14..15 SoftBreak + 15..23 "fourfive" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap new file mode 100644 index 0000000..93c096f --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"[[hps://.org]]" +0..15 [1] + 0..15 Paragraph([2]) + 0..14 RegularLink { path: Match { start: 2, end: 12, obj: Unspecified("hps://.org") }, description: None, caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap new file mode 100644 index 0000000..d760cf3 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap @@ -0,0 +1,16 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\nI'll be skipping over the instrumentals unless there's reason to.\n\n[[file:bmc.jpg]]\n** songs\n" +0..94 [1, 2, 3, 5, 7] + 0..1 BlankLine + 1..67 Paragraph([4]) + 1..66 "I'll be skipping over the instrumentals unless there's reason to." + 67..68 BlankLine + 68..85 Paragraph([6]) + 68..84 RegularLink { path: Match { start: 70, end: 82, obj: File("bmc.jpg") }, description: None, caption: None } + 85..94 Heading { heading_level: Two, keyword: None, priority: None, title: Some(("songs\n", [8])), tags: None, properties: None, children: None } + 88..93 "songs" +targets: + "songs\n" -> "songs" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap new file mode 100644 index 0000000..176d0d8 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap @@ -0,0 +1,9 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +" [[https://meo][cool site]]" +0..28 [1] + 1..28 Paragraph([3]) + 1..27 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([2]), caption: None } + 16..25 "cool site" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap new file mode 100644 index 0000000..889177c --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\nword\n[#A]\n" +0..11 [1, 2] + 0..1 BlankLine + 1..11 Paragraph([4, 3, 5]) + 1..5 "word" + 5..6 SoftBreak + 6..10 "[#A]" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap new file mode 100644 index 0000000..eaa5e76 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +" [[https://meo][cool *site* ~one two~ three *four ~five six ]]" +0..63 [1] + 1..63 Paragraph([9]) + 1..62 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([4, 3, 6, 5, 8, 7]), caption: None } + 16..21 "cool " + 21..27 Bold([2]) + 22..26 "site" + 27..28 " " + 28..37 Code("one two") + 37..45 " three *" + 45..60 "four ~five six " diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap new file mode 100644 index 0000000..c461985 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/object/link.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +" [[https://meo][cool *site* ~one two~ three *four ]]" +0..53 [1] + 1..53 Paragraph([9]) + 1..52 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([4, 3, 6, 5, 8, 7]), caption: None } + 16..21 "cool " + 21..27 Bold([2]) + 22..26 "site" + 27..28 " " + 28..37 Code("one two") + 37..45 " three *" + 45..50 "four " diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap new file mode 100644 index 0000000..f784331 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"*hello_world*" +0..14 [1] + 0..14 Paragraph([4]) + 0..13 Bold([3, 2]) + 1..6 "hello" + 6..12 Subscript(Plain("world")) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap new file mode 100644 index 0000000..3e626dd --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"~hello_world~" +0..14 [1] + 0..14 Paragraph([2]) + 0..13 Code("hello_world") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap new file mode 100644 index 0000000..693cfff --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"/hello_world/" +0..14 [1] + 0..14 Paragraph([4]) + 0..13 Italic([3, 2]) + 1..6 "hello" + 6..12 Subscript(Plain("world")) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap new file mode 100644 index 0000000..a7a7637 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"+hello_world+" +0..14 [1] + 0..14 Paragraph([4]) + 0..13 StrikeThrough([3, 2]) + 1..6 "hello" + 6..12 Subscript(Plain("world")) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap new file mode 100644 index 0000000..12b5395 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap @@ -0,0 +1,9 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"_hello_world_" +0..14 [1] + 0..14 Paragraph([3]) + 0..13 Underline([2]) + 1..12 "hello_world" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap new file mode 100644 index 0000000..3afbb29 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"=hello_world=" +0..14 [1] + 0..14 Paragraph([2]) + 0..13 Verbatim("hello_world") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap new file mode 100644 index 0000000..5e9ff26 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"abc /one *two thr/ ee* three four" +0..34 [1] + 0..34 Paragraph([5, 4, 6]) + 0..4 "abc " + 4..18 Italic([3, 2]) + 5..10 "one *" + 10..17 "two thr" + 18..33 " ee* three four" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap new file mode 100644 index 0000000..630fdfc --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"/" +0..2 [1] + 0..2 Paragraph([2]) + 0..1 "/" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap new file mode 100644 index 0000000..f6d9670 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"~~" +0..3 [1] + 0..3 Paragraph([2]) + 0..2 "~~" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap new file mode 100644 index 0000000..ac08123 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"~a~" +0..4 [1] + 0..4 Paragraph([2]) + 0..3 Code("a") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap new file mode 100644 index 0000000..2ee25ec --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"**" +0..3 [1] + 0..3 Paragraph([2]) + 0..2 "**" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap new file mode 100644 index 0000000..bf31215 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap @@ -0,0 +1,9 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"/a/" +0..4 [1] + 0..4 Paragraph([3]) + 0..3 Italic([2]) + 1..2 "a" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap new file mode 100644 index 0000000..4e59cd3 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"abc /one ~two thr/ ee~ three four" +0..34 [1] + 0..34 Paragraph([4, 3, 5]) + 0..4 "abc " + 4..18 Italic([2]) + 5..17 "one ~two thr" + 18..33 " ee~ three four" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap new file mode 100644 index 0000000..cba9e06 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap @@ -0,0 +1,14 @@ +--- +source: crates/org-parser/src/object/markup.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"abc /one *two* three/ four" +0..27 [1] + 0..27 Paragraph([7, 6, 8]) + 0..4 "abc " + 4..21 Italic([4, 3, 5]) + 5..9 "one " + 9..14 Bold([2]) + 10..13 "two" + 14..20 " three" + 21..26 " four" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap b/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap new file mode 100644 index 0000000..17731dd --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/object/org_macro.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"#+macro: poem hiii $1 $2 text\n\n{{{poem(cool, three)}}}\n" +0..55 [1, 2, 3] + 0..30 MacroDef { num_args: 2, input: [Text("hiii "), ArgNum(1), Text(" "), ArgNum(2), Text(" text")], name: "poem" } + 30..31 BlankLine + 31..55 Paragraph([4]) + 31..54 MacroCall { name: "poem", args: ["cool", " three"] } +macros: + "poem" = MacroDef { num_args: 2, input: [Text("hiii "), ArgNum(1), Text(" "), ArgNum(2), Text(" text")], name: "poem" } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap b/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap new file mode 100644 index 0000000..ebbf101 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/object/sup_sub.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"a^{\\smiley}" +0..12 [1] + 0..12 Paragraph([4, 3]) + 0..1 "a" + 1..11 Superscript(Rec([2])) + 3..10 Entity { name: "smiley", mapped_item: "☺" } diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap new file mode 100644 index 0000000..f2c6526 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap @@ -0,0 +1,11 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello /italic/ more text after\n" +0..31 [1] + 0..31 Paragraph([4, 3, 5]) + 0..6 "hello " + 6..14 Italic([2]) + 7..13 "italic" + 14..30 " more text after" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap new file mode 100644 index 0000000..c467b44 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap @@ -0,0 +1,9 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello_world\n" +0..12 [1] + 0..12 Paragraph([3, 2]) + 0..5 "hello" + 5..11 Subscript(Plain("world")) diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap new file mode 100644 index 0000000..2eb9afe --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap @@ -0,0 +1,12 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello_world\nsame_paragraph\n" +0..27 [1] + 0..27 Paragraph([3, 2, 4, 6, 5]) + 0..5 "hello" + 5..11 Subscript(Plain("world")) + 11..12 SoftBreak + 12..16 "same" + 16..26 Subscript(Plain("paragraph")) diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap new file mode 100644 index 0000000..aa86e6e --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello_world" +0..12 [1] + 0..12 Paragraph([2]) + 0..11 "hello_world" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap new file mode 100644 index 0000000..9a4eae4 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap @@ -0,0 +1,8 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"é\n" +0..3 [1] + 0..3 Paragraph([2]) + 0..2 "é" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap b/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap new file mode 100644 index 0000000..e4cc989 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap @@ -0,0 +1,15 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n- one\n- two\n\n--------------\n" +0..29 [1, 9, 10] + 0..1 BlankLine + 1..14 PlainList { children: [2, 4], kind: Unordered } + 1..7 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [3] } + 3..7 Paragraph([8]) + 3..6 "one" + 7..14 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [5] } + 9..13 Paragraph([7]) + 9..12 "two" + 14..29 HorizontalRule diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap b/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap new file mode 100644 index 0000000..494b8b2 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap @@ -0,0 +1,131 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"\n#+macro: greet Hello $1, nice typing... $1.\n* Basic Heading\n\n{{{greet(user)}}}\n\n** Child Heading\n\n- https://plain_links.com.\n - \n - src_python{(technically) inline_src}\n- [[Child Heading]]\n - \\aleph \\leftarrow entities\n\n#+begin_export\n\n#+end_export\n\n|tables!|[[targets][links to output target]]|styled,, manually :sweat_smile:\n|no|default css (yet)|\n|||||||||table\n\n1. +does+\n2. *it*\n3. /all/\n4. ~code~\n5. =code, again..=\n6. /so _nested_, *t^o_o*./\n\nemojis :flushed: :tada: :sunglasses:\n\n\\begin{align}\nx &+ 4\\\\\nabc &+ 10\\\\\n\\end{align}\noutput MathML, little janky atm (might switch to katex..?)\n\nTarget here: <>\\\\\n\n\n# doesn't look the best, imo\n-----\n\n#+begin_src rust\nnothing styled for source blocks yet, too.\n#+end_src\n\n" +0..850 [1, 2, 3] + 0..1 BlankLine + 1..45 MacroDef { num_args: 1, input: [Text("Hello "), ArgNum(1), Text(", nice typing... "), ArgNum(1), Text(".")], name: "greet" } + 45..850 Heading { heading_level: One, keyword: None, priority: None, title: Some(("Basic Heading\n", [4])), tags: None, properties: None, children: Some([5, 6, 8, 9]) } + 47..60 "Basic Heading" + 61..62 BlankLine + 62..80 Paragraph([7]) + 62..79 MacroCall { name: "greet", args: ["user"] } + 80..81 BlankLine + 81..850 Heading { heading_level: Two, keyword: None, priority: None, title: Some(("Child Heading\n", [10])), tags: Some([Loc(3)]), properties: None, children: Some([11, 35, 36, 37, 38, 39, 65, 97, 98, 105, 106, 107, 108, 109, 111, 115, 116, 117, 118, 119, 120, 121]) } + 84..97 "Child Heading" + 98..99 BlankLine + 99..253 PlainList { children: [12, 24], kind: Unordered } + 99..201 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [13, 22] } + 101..126 Paragraph([14, 23]) + 101..124 PlainLink { protocol: "https", path: "//plain_links.com" } + 124..125 "." + 128..201 PlainList { children: [15], kind: Unordered } + 128..201 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [16, 21] } + 130..158 Paragraph([17]) + 130..157 PlainLink { protocol: "mailto", path: "okiedokie@cool.com" } + 162..201 PlainList { children: [18], kind: Unordered } + 162..201 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [19] } + 164..201 Paragraph([20]) + 164..200 InlineSrc { lang: "python", headers: None, body: "(technically) inline_src" } + 201..253 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [25, 34] } + 203..221 Paragraph([26]) + 203..220 RegularLink { path: Match { start: 205, end: 218, obj: Unspecified("Child Heading") }, description: None, caption: None } + 223..253 PlainList { children: [27], kind: Unordered } + 223..253 Item { bullet: Unordered, counter_set: None, check_box: None, tag: None, children: [28] } + 225..252 Paragraph([29, 31, 30, 33]) + 225..231 Entity { name: "aleph", mapped_item: "ℵ" } + 231..232 " " + 232..242 Entity { name: "leftarrow", mapped_item: "←" } + 242..251 " entities" + 253..367 Export { backend: None, parameters: {}, contents: "\n" } + 367..368 BlankLine + 368..369 BlankLine + 369..484 Table { rows: 3, cols: 9, children: [48, 53, 64], caption: None } + 369..446 Standard([41, 44, 47]) + 370..378 TableCell([40]) + 370..377 "tables!" + 378..414 TableCell([43]) + 378..413 RegularLink { path: Match { start: 380, end: 387, obj: Unspecified("targets") }, description: Some([42]), caption: None } + 389..411 "links to output target" + 414..445 TableCell([46, 45]) + 414..432 "styled,, manually " + 432..445 Emoji { name: "sweat_smile", mapped_item: '😅' } + 446..469 Standard([50, 52]) + 447..450 TableCell([49]) + 447..449 "no" + 450..468 TableCell([51]) + 450..467 "default css (yet)" + 469..484 Standard([54, 55, 56, 57, 58, 59, 60, 61, 63]) + 470..471 TableCell([]) + 471..472 TableCell([]) + 472..473 TableCell([]) + 473..474 TableCell([]) + 474..475 TableCell([]) + 475..476 TableCell([]) + 476..477 TableCell([]) + 477..478 TableCell([]) + 478..483 TableCell([62]) + 478..483 "table" + 484..485 BlankLine + 485..569 PlainList { children: [66, 70, 74, 78, 81, 84], kind: Ordered(Number(1)) } + 485..495 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [67] } + 488..495 Paragraph([69]) + 488..494 StrikeThrough([68]) + 489..493 "does" + 495..503 Item { bullet: Ordered(Number(2)), counter_set: None, check_box: None, tag: None, children: [71] } + 498..503 Paragraph([73]) + 498..502 Bold([72]) + 499..501 "it" + 503..512 Item { bullet: Ordered(Number(3)), counter_set: None, check_box: None, tag: None, children: [75] } + 506..512 Paragraph([77]) + 506..511 Italic([76]) + 507..510 "all" + 512..522 Item { bullet: Ordered(Number(4)), counter_set: None, check_box: None, tag: None, children: [79] } + 515..522 Paragraph([80]) + 515..521 Code("code") + 522..541 Item { bullet: Ordered(Number(5)), counter_set: None, check_box: None, tag: None, children: [82] } + 525..541 Paragraph([83]) + 525..540 Verbatim("code, again..") + 541..569 Item { bullet: Ordered(Number(6)), counter_set: None, check_box: None, tag: None, children: [85] } + 544..568 Paragraph([95]) + 544..567 Italic([88, 87, 93, 92, 94]) + 545..548 "so " + 548..556 Underline([86]) + 549..555 "nested" + 556..558 ", " + 558..565 Bold([90, 89, 91]) + 559..560 "t" + 560..562 Superscript(Plain("o")) + 562..564 Subscript(Plain("o")) + 565..566 "." + 569..606 Paragraph([100, 99, 102, 101, 104, 103]) + 569..576 "emojis " + 576..585 Emoji { name: "flushed", mapped_item: '😳' } + 585..586 " " + 586..592 Emoji { name: "tada", mapped_item: '🎉' } + 592..593 " " + 593..605 Emoji { name: "sunglasses", mapped_item: '😎' } + 606..607 BlankLine + 607..653 LatexEnv { name: "align", contents: "x &+ 4\\\\\nabc &+ 10\\\\\n" } + 653..654 BlankLine + 654..713 Paragraph([110]) + 654..712 "output MathML, little janky atm (might switch to katex..?)" + 713..714 BlankLine + 714..742 Paragraph([113, 112, 114]) + 714..727 "Target here: " + 727..738 Target("targets") + 738..741 LineBreak + 742..743 BlankLine + 743..772 Comment("doesn't look the best, imo") + 772..778 HorizontalRule + 778..779 BlankLine + 779..848 Src { language: Some("rust"), parameters: {}, contents: "nothing styled for source blocks yet, too.\n" } + 848..849 BlankLine + 849..850 BlankLine +targets: + "Basic Heading\n" -> "basic-heading" + "Child Heading\n" -> "child-heading" + "targets" -> "targets" +macros: + "greet" = MacroDef { num_args: 1, input: [Text("Hello "), ArgNum(1), Text(", nice typing... "), ArgNum(1), Text(".")], name: "greet" } diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap new file mode 100644 index 0000000..62be879 --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap @@ -0,0 +1,13 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello /italic \n newline/ more text after\n" +0..41 [1] + 0..41 Paragraph([6, 5, 7]) + 0..6 "hello " + 6..24 Italic([3, 2, 4]) + 7..14 "italic " + 14..15 SoftBreak + 15..23 " newline" + 24..40 " more text after" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap new file mode 100644 index 0000000..867cf6d --- /dev/null +++ b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap @@ -0,0 +1,10 @@ +--- +source: crates/org-parser/src/lib.rs +expression: "$crate :: test_util :: snapshot_text(parser)" +--- +"hello =italic \n newline= more text after\n" +0..41 [1] + 0..41 Paragraph([3, 2, 4]) + 0..6 "hello " + 6..24 Verbatim("italic \n newline") + 24..40 " more text after" From cbec220a34972821cd6fd47c825cbcbbbc7bb85d Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:09:11 -0400 Subject: [PATCH 3/8] nit: fmt --- crates/org-exporter/src/html.rs | 6 ++- crates/org-exporter/src/include.rs | 53 +++++++++++++------------ crates/org-parser/src/element/drawer.rs | 2 +- crates/org-parser/src/lib.rs | 2 +- crates/org-parser/src/object/emoji.rs | 2 +- crates/org-parser/src/object/markup.rs | 2 +- crates/org-parser/src/object/sup_sub.rs | 2 +- crates/org-parser/src/render.rs | 1 - crates/org-wasm/src/lib.rs | 2 +- 9 files changed, 37 insertions(+), 35 deletions(-) diff --git a/crates/org-exporter/src/html.rs b/crates/org-exporter/src/html.rs index b111b52..25cee62 100644 --- a/crates/org-exporter/src/html.rs +++ b/crates/org-exporter/src/html.rs @@ -1482,7 +1482,8 @@ here (define hello (name) (string-append "hello" name)) -"#); +"# + ); } #[test] @@ -1499,6 +1500,7 @@ here (define hello (name) (string-append "hello" name)) -"#); +"# + ); } } diff --git a/crates/org-exporter/src/include.rs b/crates/org-exporter/src/include.rs index 5dfa67b..2cf364a 100644 --- a/crates/org-exporter/src/include.rs +++ b/crates/org-exporter/src/include.rs @@ -79,32 +79,33 @@ impl<'a> InclParams<'a> { let is_not_kwarg = |x: &&str| !x.starts_with(':'); - let block: Option = if let Some(potential_block) = params.next_if(is_not_kwarg) { - Some(match potential_block { - "example" => IncludeBlock::Example, - "export" => { - let backend = if let Some(potential_arg) = params.next_if(is_not_kwarg) { - Some(potential_arg) - } else { - // issue warning? - None - }; - IncludeBlock::Export { backend } - } - "src" => { - let lang = if let Some(potential_lang) = params.next_if(is_not_kwarg) { - Some(potential_lang) - } else { - // issue warning? - None - }; - IncludeBlock::Src { lang } - } - _ => Err(IncludeError::UnsupportedBlock(potential_block.into()))?, - }) - } else { - None - }; + let block: Option = + if let Some(potential_block) = params.next_if(is_not_kwarg) { + Some(match potential_block { + "example" => IncludeBlock::Example, + "export" => { + let backend = if let Some(potential_arg) = params.next_if(is_not_kwarg) { + Some(potential_arg) + } else { + // issue warning? + None + }; + IncludeBlock::Export { backend } + } + "src" => { + let lang = if let Some(potential_lang) = params.next_if(is_not_kwarg) { + Some(potential_lang) + } else { + // issue warning? + None + }; + IncludeBlock::Src { lang } + } + _ => Err(IncludeError::UnsupportedBlock(potential_block.into()))?, + }) + } else { + None + }; // defaults for kwargs let mut only_contents = false; diff --git a/crates/org-parser/src/element/drawer.rs b/crates/org-parser/src/element/drawer.rs index 7b1eaae..eff4c9a 100644 --- a/crates/org-parser/src/element/drawer.rs +++ b/crates/org-parser/src/element/drawer.rs @@ -130,8 +130,8 @@ pub(crate) fn parse_property(mut cursor: Cursor) -> Result #[cfg(test)] mod tests { - use crate::test_util::snap; use crate::parse_org; + use crate::test_util::snap; #[test] fn basic_drawer() { diff --git a/crates/org-parser/src/lib.rs b/crates/org-parser/src/lib.rs index e37eed8..f718eae 100644 --- a/crates/org-parser/src/lib.rs +++ b/crates/org-parser/src/lib.rs @@ -115,8 +115,8 @@ pub fn parse_macro_call<'a>(input: &'a str) -> Parser<'a> { #[cfg(test)] mod tests { - use crate::test_util::snap; use super::*; + use crate::test_util::snap; #[test] fn test_basic_paragraph() { diff --git a/crates/org-parser/src/object/emoji.rs b/crates/org-parser/src/object/emoji.rs index e20bdd6..acfd28c 100644 --- a/crates/org-parser/src/object/emoji.rs +++ b/crates/org-parser/src/object/emoji.rs @@ -1910,10 +1910,10 @@ pub(crate) fn parse_emoji<'a>(name: &'a str) -> Result> { #[cfg(test)] mod tests { - use crate::test_util::snap; use crate::expr_in_pool; use crate::object::Emoji; use crate::parse_org; + use crate::test_util::snap; use crate::types::Expr; #[test] diff --git a/crates/org-parser/src/object/markup.rs b/crates/org-parser/src/object/markup.rs index a78e265..8f601f0 100644 --- a/crates/org-parser/src/object/markup.rs +++ b/crates/org-parser/src/object/markup.rs @@ -143,8 +143,8 @@ plain_markup!(Verbatim, EQUAL); #[cfg(test)] mod tests { - use crate::test_util::snap; use crate::parse_org; + use crate::test_util::snap; #[test] fn basic_verbatim() { diff --git a/crates/org-parser/src/object/sup_sub.rs b/crates/org-parser/src/object/sup_sub.rs index 750c749..ba04fe7 100644 --- a/crates/org-parser/src/object/sup_sub.rs +++ b/crates/org-parser/src/object/sup_sub.rs @@ -126,8 +126,8 @@ parse_nscript!(Superscript); #[cfg(test)] mod tests { - use crate::test_util::snap; use crate::parse_org; + use crate::test_util::snap; #[test] fn basic_sup() { diff --git a/crates/org-parser/src/render.rs b/crates/org-parser/src/render.rs index 20f190c..b8d670f 100644 --- a/crates/org-parser/src/render.rs +++ b/crates/org-parser/src/render.rs @@ -59,7 +59,6 @@ fn render_section(out: &mut String, title: &str, sep: &str, map: &Hash } } - impl Parser<'_> { /// Renders the parsed tree as indented text. /// diff --git a/crates/org-wasm/src/lib.rs b/crates/org-wasm/src/lib.rs index 5685a04..d168b9e 100644 --- a/crates/org-wasm/src/lib.rs +++ b/crates/org-wasm/src/lib.rs @@ -3,7 +3,7 @@ use org_exporter::ExportError; use org_exporter::Exporter; use org_exporter::Html; use org_exporter::Org; -use org_parser::{parse_org, Expr, Node, NodeID, NodePool}; +use org_parser::{Expr, Node, NodeID, NodePool, parse_org}; use wasm_bindgen::prelude::*; use js_sys::Int32Array; From 038e2adfcad8e83f5a4904836b1aed09ffff60cf Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:13:10 -0400 Subject: [PATCH 4/8] docs: clear up wording on readme --- README.org | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index ef4dea0..1f7c574 100644 --- a/README.org +++ b/README.org @@ -50,13 +50,13 @@ Refer to the [[./docs][documentation]] for developer-specific information & synt ** Testing The parser and exporter rely on snapshot tests built on [[https://insta.rs/][insta]]. -A parser test parses a small org input and compares ~Parser::render_tree()~ against a stored snapshot (~.snap~) in ~crates//snapshots/~. -Exporter tests snapshot the exported output instead. +A snapshot test processes a small input and compares the output against a stored snapshot (~.snap~) in ~crates//snapshots/~. +Exporter tests snapshot the exported output instead, parser tests compare against ~Parser::render_tree()~ to ensure stability. *** Snapshot workflow -Run the tests as usual with ~cargo test --workspace~. -If a snapshot doesn't match (or doesn't exist yet), the test fails and ~insta~ writes the actual output next to it as a ~.snap.new~ file. +After making a change, run the tests as usual with ~cargo test --workspace~. +If a snapshot doesn't match (or doesn't exist yet), the test fails and ~insta~ generates a pending snapshot as a ~.snap.new~ file. Read the diff to verify correctness. Optionally, [[https://insta.rs/docs/cli/][cargo-insta]] offers a convenience tool for this: @@ -64,11 +64,11 @@ Read the diff to verify correctness. Optionally, [[https://insta.rs/docs/cli/][c cargo insta review #+end_src -If every change is intended, ~INSTA_UPDATE=always cargo test --workspace~ accepts them all at once, overwriting the stored snapshots without a diff. +If every change is intended, ~INSTA_UPDATE=always cargo test --workspace~ accepts them all at once, overwriting the stored snapshots directly. *** Adding a test -The snapshot is named after the module path and test name, so names must be unique within a module. +The snapshot is named after the module path and test name. 1. Run ~cargo test~. The new test fails and writes a ~.snap.new~. 2. Check, then accept it with ~cargo insta review~ / ~cargo insta accept~ or just do it manually. From b33fe4d18ba57d51de7aab1ae267ae90296d024b Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:30:04 -0400 Subject: [PATCH 5/8] feat: rework snapshot format include source text in header for clarity + remove trash --- .cargo/config.toml | 3 +++ crates/org-parser/src/test_util.rs | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..dcccff1 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[env] +# insta writes multi-line snapshot metadata as unquoted literal blocks +INSTA_YAML_BLOCK_STYLE = "1" diff --git a/crates/org-parser/src/test_util.rs b/crates/org-parser/src/test_util.rs index 7023d31..97fb293 100644 --- a/crates/org-parser/src/test_util.rs +++ b/crates/org-parser/src/test_util.rs @@ -5,25 +5,24 @@ //! //! Snapshots are stored in `/snapshots/` refer to the README for more. -use crate::types::Parser; - /// Snapshots live in one directory at the crate root, not next to each source file. pub(crate) const SNAPSHOT_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/snapshots"); -/// The source text followed by the rendered tree, so a snapshot shows its own input. -pub(crate) fn snapshot_text(parser: &Parser) -> String { - format!("{:?}\n{}", parser.source, parser.render_tree()) -} - /// Asserts that a parsed document matches its stored [`insta`] snapshot. /// -/// The macro expands in the calling test, so `insta` names the snapshot after that test -/// and names it after that test's module path. +/// The source text goes in the snapshot's YAML header as `description`, so the body is only +/// the rendered tree. Insta doesn't compare the header, only the body. macro_rules! snap { ($parser:expr) => {{ let parser = &$parser; - ::insta::with_settings!({snapshot_path => $crate::test_util::SNAPSHOT_DIR}, { - ::insta::assert_snapshot!($crate::test_util::snapshot_text(parser)); + ::insta::with_settings!({ + snapshot_path => $crate::test_util::SNAPSHOT_DIR, + // we use INSTA_YAML_BLOCK_STYLE=1 in .cargo/config.toml to ensure + // output isn't serialized (not use quotes & newlines) + description => parser.source.to_string(), + omit_expression => true, + }, { + ::insta::assert_snapshot!(parser.render_tree()); }); }}; } From 943386438a383bf926ec6622455d0e16543eeb64 Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:31:03 -0400 Subject: [PATCH 6/8] nit: update parser snaps --- ...ock__tests__big_greater_block_content.snap | 27 +++++++++- ...ement__block__tests__gblock_plus_list.snap | 9 +++- ..._block__tests__greater_block_indented.snap | 7 ++- ..._element__drawer__tests__basic_drawer.snap | 10 +++- ...ent__drawer__tests__basic_drawer_caps.snap | 10 +++- ...__heading__tests__headline_everything.snap | 16 +++++- ...headline_prio_keyword_decorated_title.snap | 4 +- ...g__tests__headline_prio_keyword_title.snap | 4 +- ...r__element__heading__tests__tag_parse.snap | 8 ++- ...nt__latex_env__tests__basic_latex_env.snap | 6 ++- ...__latex_env__tests__latex_empty_start.snap | 6 ++- ...env__tests__latex_env_failed_header-2.snap | 6 ++- ...env__tests__latex_env_failed_header-3.snap | 6 ++- ...x_env__tests__latex_env_failed_header.snap | 6 ++- ...ex_env__tests__latex_env_with_content.snap | 13 ++++- ...t__latex_env__tests__latex_failed_end.snap | 6 ++- ...lement__plain_list__tests__basic_list.snap | 5 +- ...lement__plain_list__tests__blank_list.snap | 13 ++++- ...ent__plain_list__tests__combined_list.snap | 8 ++- ...__plain_list__tests__indent_list_prop.snap | 10 +++- ..._list__tests__list_contained_elements.snap | 12 ++++- ...lain_list__tests__list_continued_item.snap | 7 ++- ...t__tests__list_elements_breaking_flow.snap | 14 ++++- ...lement__plain_list__tests__list_empty.snap | 8 ++- ..._list__tests__list_inconsistent_types.snap | 11 +++- ..._tests__list_no_item_with_sub_element.snap | 8 ++- ...lain_list__tests__list_numbered_empty.snap | 8 ++- ..._plain_list__tests__list_space_ending.snap | 12 ++++- ...nt__plain_list__tests__list_two_items.snap | 6 ++- ...ent__plain_list__tests__nested_list_2.snap | 9 +++- ...ent__plain_list__tests__nested_list_3.snap | 9 +++- ...ent__plain_list__tests__nested_list_4.snap | 7 ++- ...plain_list__tests__nested_lists_basic.snap | 7 ++- ...r__element__table__tests__basic_table.snap | 6 ++- ...nt__table__tests__table_aligned_cells.snap | 6 ++- ...ment__table__tests__table_empty_cells.snap | 6 ++- ...r__element__table__tests__table_eof_1.snap | 6 ++- ...r__element__table__tests__table_eof_2.snap | 6 ++- ...element__table__tests__table_indented.snap | 10 +++- ...nt__table__tests__table_indented_list.snap | 10 +++- ...element__table__tests__table_markup_1.snap | 6 ++- ...r__element__table__tests__table_no_nl.snap | 7 ++- ...ment__table__tests__table_uneven_cols.snap | 6 ++- ...ement__table__tests__table_with_hrule.snap | 8 ++- ...r__object__emoji__tests__failed_emoji.snap | 4 +- ...ct__latex_frag__tests__latex_frag_all.snap | 17 +++++- ...tex_frag__tests__latex_frag_command_4.snap | 3 +- ...latex_frag__tests__latex_frag_pretext.snap | 5 +- ...ject__link__tests__basic_regular_link.snap | 3 +- ...arser__object__link__tests__file_link.snap | 8 ++- ...link__tests__regular_link_description.snap | 3 +- ...__link__tests__regular_link_malformed.snap | 6 ++- ...s__regular_link_unclosed_plain_markup.snap | 3 +- ...egular_link_unclosed_recursive_markup.snap | 3 +- ...er__object__markup__tests__basic_bold.snap | 3 +- ...er__object__markup__tests__basic_code.snap | 3 +- ...__object__markup__tests__basic_italic.snap | 3 +- ...t__markup__tests__basic_strikethrough.snap | 3 +- ...bject__markup__tests__basic_underline.snap | 3 +- ...object__markup__tests__basic_verbatim.snap | 3 +- ...__object__markup__tests__leaky_markup.snap | 3 +- ...markup__tests__markup_not_fail_on_eof.snap | 3 +- ...ct__markup__tests__markup_plain_empty.snap | 3 +- ...rkup__tests__markup_plain_single_char.snap | 3 +- ...markup__tests__markup_recursive_empty.snap | 3 +- ...__tests__markup_recursive_single_char.snap | 3 +- ...s__mixed_plain_recursive_leaky_markup.snap | 3 +- ..._object__markup__tests__nested_markup.snap | 3 +- ...ct__org_macro__tests__combined_macros.snap | 6 ++- ...er__object__sup_sub__tests__basic_sup.snap | 3 +- .../org_rust_parser__tests__basic_markup.snap | 4 +- ...g_rust_parser__tests__basic_paragraph.snap | 4 +- ...arser__tests__basic_paragraph_newline.snap | 5 +- ..._parser__tests__basic_paragraph_no_nl.snap | 3 +- ...org_rust_parser__tests__basic_unicode.snap | 4 +- ...rust_parser__tests__correctness_cache.snap | 8 ++- .../org_rust_parser__tests__lots.snap | 54 ++++++++++++++++++- ...rser__tests__newline_in_italic_markup.snap | 5 +- ...st_parser__tests__newline_in_verbatim.snap | 5 +- 79 files changed, 415 insertions(+), 158 deletions(-) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap index d14d6a7..5c7a57a 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__big_greater_block_content.snap @@ -1,8 +1,31 @@ --- source: crates/org-parser/src/element/block.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + #+begin_quote + + /formatted text? such thing!/ + *abc* + + * headlines too + anything is possible + + blank lines + + #+keyword: one + + #+begin_src rust + let nest = Some() + + if let Some(nested) = nest { + dbg!(meta); + } + + #+end_src + + ** headline :tag:meow: + #+end_quote --- -"\n#+begin_quote\n\n/formatted text? such thing!/\n*abc*\n\n* headlines too\nanything is possible\n\nblank lines\n\n#+keyword: one\n\n#+begin_src rust\nlet nest = Some()\n\nif let Some(nested) = nest {\n dbg!(meta);\n}\n\n#+end_src\n\n** headline :tag:meow:\n#+end_quote\n" 0..250 [1, 2, 26] 0..1 BlankLine 1..249 Quote { parameters: {}, contents: [3, 4, 10, 11] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap index 7748dec..818b00b 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__gblock_plus_list.snap @@ -1,8 +1,13 @@ --- source: crates/org-parser/src/element/block.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - a + #+begin_quote + hiiiiiiiiiiiiiiiiiii + #+end_quote + - --- -"\n- a\n #+begin_quote\nhiiiiiiiiiiiiiiiiiii\n #+end_quote\n-\n" 0..60 [1, 10] 0..1 BlankLine 1..60 PlainList { children: [2, 9], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap index 57fdf3b..701e1bc 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__block__tests__greater_block_indented.snap @@ -1,8 +1,11 @@ --- source: crates/org-parser/src/element/block.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + #+begin_swag + we are eating so good? + #+end_swag --- -"\n #+begin_swag\n we are eating so good?\n #+end_swag\n" 0..87 [1, 2, 5] 0..1 BlankLine 14..86 Special { parameters: {}, contents: [3], name: "swag" } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap index cdada12..c21be25 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer.snap @@ -1,8 +1,14 @@ --- source: crates/org-parser/src/element/drawer.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + + :NAME: + hello + :end: + + halloo --- -"\n\n:NAME:\nhello\n:end:\n\nhalloo\n" 0..29 [1, 2, 3, 6, 7, 8] 0..1 BlankLine 1..2 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap index afd6d05..ea11021 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__drawer__tests__basic_drawer_caps.snap @@ -1,8 +1,14 @@ --- source: crates/org-parser/src/element/drawer.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + + :NAME: + hello + :END: + + halloo --- -"\n\n:NAME:\nhello\n:END:\n\nhalloo\n" 0..29 [1, 2, 3, 6, 7, 8] 0..1 BlankLine 1..2 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap index de9507c..e7a9b34 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_everything.snap @@ -1,8 +1,20 @@ --- source: crates/org-parser/src/element/heading.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + * DONE [#0] *one* two /three/ /four* :one:two:three:four: + more content here this is a pargraph + ** [#1] descendant headline :five: + *** [#2] inherit the tags + ** [#3] different level + subcontent + this + + is a different paragraph + id) = + more subcontent + + * [#4] separate andy --- -"* DONE [#0] *one* two /three/ /four* :one:two:three:four:\nmore content here this is a pargraph\n** [#1] descendant headline :five:\n*** [#2] inherit the tags\n** [#3] different level\nsubcontent\nthis\n\nis a different paragraph\nid) =\nmore subcontent\n\n* [#4] separate andy\n" 0..272 [1, 28] 0..251 Heading { heading_level: One, keyword: Some("DONE"), priority: Some(Num(0)), title: Some(("*one* two /three/ /four*", [3, 6, 5, 8, 7])), tags: Some([Raw("four"), Raw("three"), Raw("two"), Raw("one")]), properties: None, children: Some([9, 10, 14]) } 12..17 Bold([2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap index 7745375..50105d1 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_decorated_title.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/element/heading.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + * TODO [#A] *one* two /three/ /four* --- -"* TODO [#A] *one* two /three/ /four* \n" 0..38 [1] 0..38 Heading { heading_level: One, keyword: Some("TODO"), priority: Some(A), title: Some(("*one* two /three/ /four* \n", [3, 6, 5, 8, 7])), tags: None, properties: None, children: None } 12..17 Bold([2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap index 9c33482..6a01a31 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__headline_prio_keyword_title.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/element/heading.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + * TODO [#A] SWAG --- -"* TODO [#A] SWAG \n" 0..18 [1] 0..18 Heading { heading_level: One, keyword: Some("TODO"), priority: Some(A), title: Some(("SWAG \n", [2])), tags: None, properties: None, children: None } 12..17 "SWAG " diff --git a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap index ec6de15..a3a896d 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__heading__tests__tag_parse.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/heading.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |- + + * q ac:qbc: + qqqqq + + aaaa --- -"\n* q ac:qbc:\nqqqqq\n\naaaa" 0..25 [1, 2] 0..1 BlankLine 1..25 Heading { heading_level: One, keyword: None, priority: None, title: Some(("q ac:qbc:\n", [3])), tags: None, properties: None, children: Some([4, 5, 7]) } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap index a369726..22d26f1 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__basic_latex_env.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{align*} + \end{align*} --- -"\n\\begin{align*}\n\\end{align*}\n" 0..29 [1, 2] 0..1 BlankLine 1..29 Paragraph([3, 4, 5]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap index fa10183..9ee37b1 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_empty_start.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{} + \end{} --- -"\n\\begin{}\n\\end{}\n" 0..17 [1, 2, 3] 0..1 BlankLine 1..16 LatexEnv { name: "", contents: "" } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap index 092a4eb..3be177e 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-2.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{a13214-} + \end{a13214-} --- -"\n\\begin{a13214-}\n\\end{a13214-}\n" 0..31 [1, 2] 0..1 BlankLine 1..31 Paragraph([3, 4, 5]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap index 9136bcc..31b6729 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header-3.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{one}more stuff + \end{one} --- -"\n\\begin{one}more stuff\n\\end{one}\n" 0..33 [1, 2] 0..1 BlankLine 1..33 Paragraph([3, 5, 4, 6]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap index 31d166a..2de2624 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_failed_header.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{star!} + \end{star!} --- -"\n\\begin{star!}\n\\end{star!}\n" 0..27 [1, 2] 0..1 BlankLine 1..27 Paragraph([3, 4, 5]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap index fea616c..86495fe 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_env_with_content.snap @@ -1,8 +1,17 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{align*} + + \text{latex constructs}\\ + \alpha\\ + \beta\\ + + 10x + 4 &= 3\\ + + \end{align*} --- -"\n\\begin{align*}\n\n\\text{latex constructs}\\\\\n\\alpha\\\\\n\\beta\\\\\n\n10x + 4 &= 3\\\\\n\n\\end{align*}\n" 0..90 [1, 2, 4, 5] 0..1 BlankLine 1..16 Paragraph([3]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap index c3b0061..8978461 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__latex_env__tests__latex_failed_end.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/latex_env.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + \begin{start} + \end{notstart} --- -"\n\\begin{start}\n\\end{notstart}\n" 0..30 [1, 2] 0..1 BlankLine 1..30 Paragraph([3, 4, 5]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap index 2664baf..8c0d2d3 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__basic_list.snap @@ -1,8 +1,9 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one --- -"\n- one\n" 0..7 [1, 5] 0..1 BlankLine 1..7 PlainList { children: [2], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap index a6a1790..be00d51 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__blank_list.snap @@ -1,8 +1,17 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + 1. item 1 + abcdef + + next one two three four five + + more thangs more thangs more thangs + more thangs + + 2. [X] item 2 + - aome tag :: item 2.1 --- -"1. item 1\n abcdef\n\n next one two three four five\n\n more thangs more thangs more thangs\n more thangs\n\n2. [X] item 2\n - aome tag :: item 2.1\n" 0..149 [22] 0..149 PlainList { children: [1, 15], kind: Ordered(Number(1)) } 0..109 Item { bullet: Ordered(Number(1)), counter_set: None, check_box: None, tag: None, children: [2, 5, 7, 8, 10] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap index 61eee1b..8ede812 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__combined_list.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - zero + - one + + a* --- -"\n- zero\n- one\n\na*\n" 0..18 [1, 9, 10] 0..1 BlankLine 1..15 PlainList { children: [2, 4], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap index b6bf954..77f1645 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__indent_list_prop.snap @@ -1,8 +1,14 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + - qq + + + heyy --- -"\n- one\n- two\n - qq\n\n\n heyy\n" 0..28 [1, 14, 8, 10, 15] 0..1 BlankLine 1..20 PlainList { children: [2, 4], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap index 1a07084..2b9b050 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_contained_elements.snap @@ -1,8 +1,16 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + abcd + eif + #+begin_example + we are eating so good? + #+end_example + + - two --- -"\n- one\n abcd\n eif\n #+begin_example\n we are eating so good?\n #+end_example\n\n- two\n" 0..94 [1, 12, 10, 11, 16] 0..1 BlankLine 1..86 PlainList { children: [2], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap index 672d76f..51c702b 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_continued_item.snap @@ -1,8 +1,11 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + abcdef + - two --- -"\n- one\n abcdef\n- two\n" 0..21 [1, 10] 0..1 BlankLine 1..21 PlainList { children: [2, 6], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap index b274eac..10582f5 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_elements_breaking_flow.snap @@ -1,8 +1,18 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + abcdef + - four + this aint a list baby + #+begin_src python + not a list too + #+end_src + + + - five --- -"\n- one\n abcdef\n- four\nthis aint a list baby\n#+begin_src python\nnot a list too\n#+end_src\n\n\n- five\n" 0..97 [1, 10, 11, 12, 14, 15, 16, 20] 0..1 BlankLine 1..22 PlainList { children: [2, 6], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap index f7a9842..e9b36dd 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_empty.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - + - + - + - --- -"\n-\n-\n-\n-\n" 0..9 [1, 6] 0..1 BlankLine 1..9 PlainList { children: [2, 3, 4, 5], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap index fa25f7d..84b3691 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_inconsistent_types.snap @@ -1,8 +1,15 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + abcdef + 1. two + 2. three + 3. four + - five + - six --- -"\n- one\n abcdef\n1. two\n2. three\n3. four\n- five\n- six\n" 0..52 [1, 22, 24, 26] 0..1 BlankLine 1..15 PlainList { children: [2], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap index 7760fdb..a9591a7 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_no_item_with_sub_element.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + - [X] + |a|a|a|a| + + - + --- -"- [X]\n |a|a|a|a|\n\n-\n\n" 0..28 [15] 0..28 PlainList { children: [1, 13], kind: Unordered } 0..25 Item { bullet: Unordered, counter_set: None, check_box: Some(On), tag: None, children: [2] } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap index 97d2294..21e66c0 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_numbered_empty.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + 1. + 2. + 3. + 4. --- -"\n1.\n2.\n3.\n4.\n" 0..13 [1, 6] 0..1 BlankLine 1..13 PlainList { children: [2, 3, 4, 5], kind: Ordered(Number(1)) } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap index e5a3cc0..ba50ca0 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_space_ending.snap @@ -1,8 +1,16 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + abcdef + - two + - three + - four + + + - five --- -"\n- one\n abcdef\n- two\n- three\n- four\n\n\n- five\n" 0..45 [1, 18, 12, 14, 22] 0..1 BlankLine 1..36 PlainList { children: [2, 6, 8, 10], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap index d8809a5..df497e1 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__list_two_items.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two --- -"\n- one\n- two\n" 0..13 [1, 8] 0..1 BlankLine 1..13 PlainList { children: [2, 4], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap index 74a5cfd..86f7bc9 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_2.snap @@ -1,8 +1,13 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + - three + - four + - five --- -"\n- one\n - two\n - three\n - four\n- five\n" 0..44 [1, 20] 0..1 BlankLine 1..44 PlainList { children: [2, 17], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap index 539450e..ca14089 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_3.snap @@ -1,8 +1,13 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + - three + - four + - five --- -"\n- one\n - two\n - three\n - four\n- five\n" 0..43 [1, 19] 0..1 BlankLine 1..43 PlainList { children: [2, 16], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap index 431abd9..9a223fc 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_list_4.snap @@ -1,8 +1,11 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + 1. item 1 + 2. [X] item 2 + - some tag :: item 2.1 --- -"\n1. item 1\n2. [X] item 2\n - some tag :: item 2.1\n" 0..51 [1, 12] 0..1 BlankLine 1..51 PlainList { children: [2, 4], kind: Ordered(Number(1)) } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap index 81d76e1..93d2cb9 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__plain_list__tests__nested_lists_basic.snap @@ -1,8 +1,11 @@ --- source: crates/org-parser/src/element/plain_list.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + - three --- -"\n- one\n - two\n- three\n" 0..22 [1, 12] 0..1 BlankLine 1..22 PlainList { children: [2, 9], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap index ca040a9..70bcb6b 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__basic_table.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + |one|two| + |three|four| --- -"\n|one|two|\n|three|four|\n" 0..24 [1, 2] 0..1 BlankLine 1..24 Table { rows: 2, cols: 2, children: [7, 12], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap index 893bd57..f682c47 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_aligned_cells.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + |one two |three| + |s | | --- -"\n|one two |three|\n|s | |\n" 0..35 [1, 2] 0..1 BlankLine 1..35 Table { rows: 2, cols: 2, children: [7, 12], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap index 3a1fec4..440a854 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_empty_cells.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + ||a| + |b|| --- -"\n||a|\n|b||\n" 0..11 [1, 2] 0..1 BlankLine 1..11 Table { rows: 2, cols: 2, children: [6, 10], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap index ca040a9..70bcb6b 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_1.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + |one|two| + |three|four| --- -"\n|one|two|\n|three|four|\n" 0..24 [1, 2] 0..1 BlankLine 1..24 Table { rows: 2, cols: 2, children: [7, 12], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap index f5dbd83..972c8bb 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_eof_2.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |- + + |one|two| + |three|four| --- -"\n|one|two|\n|three|four|" 0..23 [1, 2] 0..1 BlankLine 1..23 Table { rows: 2, cols: 2, children: [7, 12], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap index 4404cf7..69acb2a 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented.snap @@ -1,8 +1,14 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + + word + |one two |three| + |s | | + |four | five| + word + --- -"\nword\n |one two |three|\n |s | |\n |four | five|\nword\n\n" 0..84 [1, 2, 3, 20, 21] 0..1 BlankLine 1..6 Paragraph([19]) diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap index 25904c2..a4d4284 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_indented_list.snap @@ -1,8 +1,14 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + |one two |three| + |s | | + |four | five| + - three --- -"\n- one\n - two\n |one two |three|\n |s | |\n |four | five|\n- three\n" 0..96 [1, 28] 0..1 BlankLine 1..96 PlainList { children: [2, 25], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap index 90297ca..809475d 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_markup_1.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + |one|tw *o* | + |three|four| --- -"\n|one|tw *o* |\n|three|four|\n" 0..65 [1, 2] 0..1 BlankLine 1..65 Table { rows: 2, cols: 2, children: [10, 15], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap index 655eb12..df558b8 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_no_nl.snap @@ -1,8 +1,11 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + + |one|two + |three|four + --- -"\n|one|two\n|three|four\n\n" 0..23 [1, 2, 13] 0..1 BlankLine 1..22 Table { rows: 2, cols: 2, children: [7, 12], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap index 39d0f7b..43aaf4d 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_uneven_cols.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + |one two |three||||| + |s | | --- -"\n|one two |three|||||\n|s | |\n" 0..39 [1, 2] 0..1 BlankLine 1..39 Table { rows: 2, cols: 6, children: [11, 16], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap index ee4c2e0..149308d 100644 --- a/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap +++ b/crates/org-parser/snapshots/org_rust_parser__element__table__tests__table_with_hrule.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/element/table.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + + |one|two + |--------| + |three|four + --- -"\n|one|two\n|--------|\n|three|four\n\n" 0..34 [1, 2, 14] 0..1 BlankLine 1..33 Table { rows: 3, cols: 2, children: [7, 8, 13], caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap b/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap index 0e2008c..3474fba 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__emoji__tests__failed_emoji.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/object/emoji.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + :flu shed: abc --- -":flu shed: abc\n" 0..16 [1] 0..16 Paragraph([2]) 0..15 ":flu shed: abc" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap index 705e631..4ec31af 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_all.snap @@ -1,8 +1,21 @@ --- source: crates/org-parser/src/object/latex_frag.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + + $\alpha$ $$do + llar$$ + \[display + block\] \(consecutive gaming\) + + \command + + \comma + and + + \command{ab + c} + --- -"\n$\\alpha$ $$do\nllar$$\n\\[display\n block\\] \\(consecutive gaming\\)\n\n\\command\n\n\\comma\nand\n\n\\command{ab\nc}\n\n" 0..103 [1, 2, 10, 11, 13, 14, 17, 19, 22] 0..1 BlankLine 1..64 Paragraph([3, 5, 4, 6, 7, 9, 8]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap index 0ce5354..11b59e3 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_command_4.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/latex_frag.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "\\) not a command" --- -"\\) not a command" 0..17 [1] 0..17 Paragraph([2]) 0..16 "\\) not a command" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap index a7a1437..25afd05 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__latex_frag__tests__latex_frag_pretext.snap @@ -1,8 +1,9 @@ --- source: crates/org-parser/src/object/latex_frag.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |- + one two $three + fourfive --- -"one two $three\nfourfive" 0..24 [1] 0..24 Paragraph([3, 2, 4]) 0..14 "one two $three" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap index 93c096f..ab9aca4 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__basic_regular_link.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "[[hps://.org]]" --- -"[[hps://.org]]" 0..15 [1] 0..15 Paragraph([2]) 0..14 RegularLink { path: Match { start: 2, end: 12, obj: Unspecified("hps://.org") }, description: None, caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap index d760cf3..6606f96 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__file_link.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + I'll be skipping over the instrumentals unless there's reason to. + + [[file:bmc.jpg]] + ** songs --- -"\nI'll be skipping over the instrumentals unless there's reason to.\n\n[[file:bmc.jpg]]\n** songs\n" 0..94 [1, 2, 3, 5, 7] 0..1 BlankLine 1..67 Paragraph([4]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap index 176d0d8..081eb38 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_description.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: " [[https://meo][cool site]]" --- -" [[https://meo][cool site]]" 0..28 [1] 1..28 Paragraph([3]) 1..27 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([2]), caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap index 889177c..e2617ac 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_malformed.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + word + [#A] --- -"\nword\n[#A]\n" 0..11 [1, 2] 0..1 BlankLine 1..11 Paragraph([4, 3, 5]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap index eaa5e76..d818040 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_plain_markup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: " [[https://meo][cool *site* ~one two~ three *four ~five six ]]" --- -" [[https://meo][cool *site* ~one two~ three *four ~five six ]]" 0..63 [1] 1..63 Paragraph([9]) 1..62 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([4, 3, 6, 5, 8, 7]), caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap index c461985..01f59c6 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__link__tests__regular_link_unclosed_recursive_markup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/link.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: " [[https://meo][cool *site* ~one two~ three *four ]]" --- -" [[https://meo][cool *site* ~one two~ three *four ]]" 0..53 [1] 1..53 Paragraph([9]) 1..52 RegularLink { path: Match { start: 3, end: 14, obj: PlainLink(PlainLink { protocol: "https", path: "//meo" }) }, description: Some([4, 3, 6, 5, 8, 7]), caption: None } diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap index f784331..7d4d800 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_bold.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "*hello_world*" --- -"*hello_world*" 0..14 [1] 0..14 Paragraph([4]) 0..13 Bold([3, 2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap index 3e626dd..d0e856c 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_code.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: ~hello_world~ --- -"~hello_world~" 0..14 [1] 0..14 Paragraph([2]) 0..13 Code("hello_world") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap index 693cfff..94db943 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_italic.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: /hello_world/ --- -"/hello_world/" 0..14 [1] 0..14 Paragraph([4]) 0..13 Italic([3, 2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap index a7a7637..0d99137 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_strikethrough.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: +hello_world+ --- -"+hello_world+" 0..14 [1] 0..14 Paragraph([4]) 0..13 StrikeThrough([3, 2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap index 12b5395..bccf605 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_underline.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: _hello_world_ --- -"_hello_world_" 0..14 [1] 0..14 Paragraph([3]) 0..13 Underline([2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap index 3afbb29..b7a32b2 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__basic_verbatim.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "=hello_world=" --- -"=hello_world=" 0..14 [1] 0..14 Paragraph([2]) 0..13 Verbatim("hello_world") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap index 5e9ff26..edc2043 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__leaky_markup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: abc /one *two thr/ ee* three four --- -"abc /one *two thr/ ee* three four" 0..34 [1] 0..34 Paragraph([5, 4, 6]) 0..4 "abc " diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap index 630fdfc..3aa3e0c 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_not_fail_on_eof.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: / --- -"/" 0..2 [1] 0..2 Paragraph([2]) 0..1 "/" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap index f6d9670..ab8393a 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_empty.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: ~~ --- -"~~" 0..3 [1] 0..3 Paragraph([2]) 0..2 "~~" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap index ac08123..a60e1fe 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_plain_single_char.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: ~a~ --- -"~a~" 0..4 [1] 0..4 Paragraph([2]) 0..3 Code("a") diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap index 2ee25ec..22791ad 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_empty.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "**" --- -"**" 0..3 [1] 0..3 Paragraph([2]) 0..2 "**" diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap index bf31215..bcedd32 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__markup_recursive_single_char.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: /a/ --- -"/a/" 0..4 [1] 0..4 Paragraph([3]) 0..3 Italic([2]) diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap index 4e59cd3..f191aa7 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__mixed_plain_recursive_leaky_markup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: abc /one ~two thr/ ee~ three four --- -"abc /one ~two thr/ ee~ three four" 0..34 [1] 0..34 Paragraph([4, 3, 5]) 0..4 "abc " diff --git a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap index cba9e06..a0be177 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__markup__tests__nested_markup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/markup.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: abc /one *two* three/ four --- -"abc /one *two* three/ four" 0..27 [1] 0..27 Paragraph([7, 6, 8]) 0..4 "abc " diff --git a/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap b/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap index 17731dd..71d7df1 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__org_macro__tests__combined_macros.snap @@ -1,8 +1,10 @@ --- source: crates/org-parser/src/object/org_macro.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + #+macro: poem hiii $1 $2 text + + {{{poem(cool, three)}}} --- -"#+macro: poem hiii $1 $2 text\n\n{{{poem(cool, three)}}}\n" 0..55 [1, 2, 3] 0..30 MacroDef { num_args: 2, input: [Text("hiii "), ArgNum(1), Text(" "), ArgNum(2), Text(" text")], name: "poem" } 30..31 BlankLine diff --git a/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap b/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap index ebbf101..a01f701 100644 --- a/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__object__sup_sub__tests__basic_sup.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/object/sup_sub.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: "a^{\\smiley}" --- -"a^{\\smiley}" 0..12 [1] 0..12 Paragraph([4, 3]) 0..1 "a" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap index f2c6526..bc4dbe0 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_markup.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + hello /italic/ more text after --- -"hello /italic/ more text after\n" 0..31 [1] 0..31 Paragraph([4, 3, 5]) 0..6 "hello " diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap index c467b44..aeed5f0 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + hello_world --- -"hello_world\n" 0..12 [1] 0..12 Paragraph([3, 2]) 0..5 "hello" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap index 2eb9afe..957ae71 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_newline.snap @@ -1,8 +1,9 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + hello_world + same_paragraph --- -"hello_world\nsame_paragraph\n" 0..27 [1] 0..27 Paragraph([3, 2, 4, 6, 5]) 0..5 "hello" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap index aa86e6e..c65e822 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_paragraph_no_nl.snap @@ -1,8 +1,7 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: hello_world --- -"hello_world" 0..12 [1] 0..12 Paragraph([2]) 0..11 "hello_world" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap b/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap index 9a4eae4..749aa5e 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__basic_unicode.snap @@ -1,8 +1,8 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + é --- -"é\n" 0..3 [1] 0..3 Paragraph([2]) 0..2 "é" diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap b/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap index e4cc989..a531004 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__correctness_cache.snap @@ -1,8 +1,12 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + + - one + - two + + -------------- --- -"\n- one\n- two\n\n--------------\n" 0..29 [1, 9, 10] 0..1 BlankLine 1..14 PlainList { children: [2, 4], kind: Unordered } diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap b/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap index 494b8b2..c8ab026 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__lots.snap @@ -1,8 +1,58 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: |+ + + #+macro: greet Hello $1, nice typing... $1. + * Basic Heading + + {{{greet(user)}}} + + ** Child Heading + + - https://plain_links.com. + - + - src_python{(technically) inline_src} + - [[Child Heading]] + - \aleph \leftarrow entities + + #+begin_export + + #+end_export + + |tables!|[[targets][links to output target]]|styled,, manually :sweat_smile: + |no|default css (yet)| + |||||||||table + + 1. +does+ + 2. *it* + 3. /all/ + 4. ~code~ + 5. =code, again..= + 6. /so _nested_, *t^o_o*./ + + emojis :flushed: :tada: :sunglasses: + + \begin{align} + x &+ 4\\ + abc &+ 10\\ + \end{align} + output MathML, little janky atm (might switch to katex..?) + + Target here: <>\\ + + + # doesn't look the best, imo + ----- + + #+begin_src rust + nothing styled for source blocks yet, too. + #+end_src + --- -"\n#+macro: greet Hello $1, nice typing... $1.\n* Basic Heading\n\n{{{greet(user)}}}\n\n** Child Heading\n\n- https://plain_links.com.\n - \n - src_python{(technically) inline_src}\n- [[Child Heading]]\n - \\aleph \\leftarrow entities\n\n#+begin_export\n\n#+end_export\n\n|tables!|[[targets][links to output target]]|styled,, manually :sweat_smile:\n|no|default css (yet)|\n|||||||||table\n\n1. +does+\n2. *it*\n3. /all/\n4. ~code~\n5. =code, again..=\n6. /so _nested_, *t^o_o*./\n\nemojis :flushed: :tada: :sunglasses:\n\n\\begin{align}\nx &+ 4\\\\\nabc &+ 10\\\\\n\\end{align}\noutput MathML, little janky atm (might switch to katex..?)\n\nTarget here: <>\\\\\n\n\n# doesn't look the best, imo\n-----\n\n#+begin_src rust\nnothing styled for source blocks yet, too.\n#+end_src\n\n" 0..850 [1, 2, 3] 0..1 BlankLine 1..45 MacroDef { num_args: 1, input: [Text("Hello "), ArgNum(1), Text(", nice typing... "), ArgNum(1), Text(".")], name: "greet" } diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap index 62be879..dc8518f 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_italic_markup.snap @@ -1,8 +1,9 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + hello /italic + newline/ more text after --- -"hello /italic \n newline/ more text after\n" 0..41 [1] 0..41 Paragraph([6, 5, 7]) 0..6 "hello " diff --git a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap index 867cf6d..6e88472 100644 --- a/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap +++ b/crates/org-parser/snapshots/org_rust_parser__tests__newline_in_verbatim.snap @@ -1,8 +1,9 @@ --- source: crates/org-parser/src/lib.rs -expression: "$crate :: test_util :: snapshot_text(parser)" +description: | + hello =italic + newline= more text after --- -"hello =italic \n newline= more text after\n" 0..41 [1] 0..41 Paragraph([3, 2, 4]) 0..6 "hello " From 265881cf659b1446687f408f1d1b15ca0fb94afe Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:41:26 -0400 Subject: [PATCH 7/8] feat: handle org-exporter snaps inline --- README.org | 3 +- ..._exporter__html__tests__correct_cache.snap | 11 ----- .../org_rust_exporter__org__tests__beeg.snap | 46 ------------------- ...rust_exporter__org__tests__list_words.snap | 12 ----- .../org_rust_exporter__utils__tests__toc.snap | 18 -------- crates/org-exporter/src/html.rs | 10 +++- crates/org-exporter/src/lib.rs | 11 ----- crates/org-exporter/src/org.rs | 45 +++++++++++++++++- crates/org-exporter/src/utils.rs | 17 ++++++- 9 files changed, 71 insertions(+), 102 deletions(-) delete mode 100644 crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap delete mode 100644 crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap delete mode 100644 crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap delete mode 100644 crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap diff --git a/README.org b/README.org index 1f7c574..206e7db 100644 --- a/README.org +++ b/README.org @@ -51,7 +51,8 @@ Refer to the [[./docs][documentation]] for developer-specific information & synt The parser and exporter rely on snapshot tests built on [[https://insta.rs/][insta]]. A snapshot test processes a small input and compares the output against a stored snapshot (~.snap~) in ~crates//snapshots/~. -Exporter tests snapshot the exported output instead, parser tests compare against ~Parser::render_tree()~ to ensure stability. +Parser tests compare against the output ~Parser::render_tree()~ to ensure stability. +Exporter snapshot tests are handled [[https://insta.rs/docs/quickstart/#inline-snapshots][inline]]. *** Snapshot workflow diff --git a/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap b/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap deleted file mode 100644 index 7ab018e..0000000 --- a/crates/org-exporter/snapshots/org_rust_exporter__html__tests__correct_cache.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: crates/org-exporter/src/html.rs -expression: a ---- -
    -
  • one

    -
  • -
  • two

    -
  • -
-abc+10 diff --git a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap deleted file mode 100644 index e29baf6..0000000 --- a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__beeg.snap +++ /dev/null @@ -1,46 +0,0 @@ ---- -source: crates/org-exporter/src/org.rs -expression: out ---- -* DONE [#0] *one* two /three/ /four* :one:two:three:four: -more content here this is a pargraph -** [#1] descendant headline :five: -*** [#2] inherit the tags -** [#3] different level -subcontent this more content here this is a pargraph -** [#1] descendant headline :five: -*** [#2] inherit the tags -** [#3] different level -subcontent this - -is a different paragraph id) = more subcontent - -* [#4] separate andy -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph - -is a different paragraph id) = more subcontent - -* [#4] separate andy -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph -** [#1] descendant headline :five: -*** [#2] inherit the tags -** [#3] different level -subcontent this - -is a different paragraph id) = more subcontent - -* [#4] separate andy -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph -** [#1] descendant headline :five: -*** [#2] inherit the tags -** [#3] different level -subcontent this - -is a different paragraph id) = more subcontent - -* [#4] separate andy -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph -** a -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph -* a -more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph diff --git a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap b/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap deleted file mode 100644 index 6b41cc3..0000000 --- a/crates/org-exporter/snapshots/org_rust_exporter__org__tests__list_words.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: crates/org-exporter/src/org.rs -expression: stripped ---- - -1. item 1 abcdef - - next one two three four five - - more thangs more thangs more thangs more thangs -2. [X] item 2 - - aome tag :: item 2.1 diff --git a/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap b/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap deleted file mode 100644 index 0249c36..0000000 --- a/crates/org-exporter/snapshots/org_rust_exporter__utils__tests__toc.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: crates/org-exporter/src/utils.rs -expression: a ---- - - - -

swag

-

abc

-

love

-

3

diff --git a/crates/org-exporter/src/html.rs b/crates/org-exporter/src/html.rs index 25cee62..18e135a 100644 --- a/crates/org-exporter/src/html.rs +++ b/crates/org-exporter/src/html.rs @@ -1079,7 +1079,15 @@ abc &+ 10\\ \end{align} ", ); - snap!(a); + insta::assert_snapshot!(a, @r#" +
    +
  • one

    +
  • +
  • two

    +
  • +
+ abc+10 + "#); } #[test] diff --git a/crates/org-exporter/src/lib.rs b/crates/org-exporter/src/lib.rs index 7d7d8b0..db19f59 100644 --- a/crates/org-exporter/src/lib.rs +++ b/crates/org-exporter/src/lib.rs @@ -31,17 +31,6 @@ //! assert_eq!(org_str, "* Hello Org!\n"); //! ``` -/// Asserts a value against its `insta` snapshot, stored in `/snapshots/`. -#[cfg(test)] -macro_rules! snap { - ($value:expr) => { - ::insta::with_settings!( - {snapshot_path => concat!(env!("CARGO_MANIFEST_DIR"), "/snapshots")}, - { ::insta::assert_snapshot!($value); } - ) - }; -} - mod html; mod include; mod org; diff --git a/crates/org-exporter/src/org.rs b/crates/org-exporter/src/org.rs index 36dcdef..ffce0ef 100644 --- a/crates/org-exporter/src/org.rs +++ b/crates/org-exporter/src/org.rs @@ -880,7 +880,50 @@ more content here this is a pargraph ", ); - snap!(out); + insta::assert_snapshot!(out, @" + * DONE [#0] *one* two /three/ /four* :one:two:three:four: + more content here this is a pargraph + ** [#1] descendant headline :five: + *** [#2] inherit the tags + ** [#3] different level + subcontent this more content here this is a pargraph + ** [#1] descendant headline :five: + *** [#2] inherit the tags + ** [#3] different level + subcontent this + + is a different paragraph id) = more subcontent + + * [#4] separate andy + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + + is a different paragraph id) = more subcontent + + * [#4] separate andy + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + ** [#1] descendant headline :five: + *** [#2] inherit the tags + ** [#3] different level + subcontent this + + is a different paragraph id) = more subcontent + + * [#4] separate andy + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + ** [#1] descendant headline :five: + *** [#2] inherit the tags + ** [#3] different level + subcontent this + + is a different paragraph id) = more subcontent + + * [#4] separate andy + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + ** a + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + * a + more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph more content here this is a pargraph + "); } #[test] diff --git a/crates/org-exporter/src/utils.rs b/crates/org-exporter/src/utils.rs index 49199dc..53d7674 100644 --- a/crates/org-exporter/src/utils.rs +++ b/crates/org-exporter/src/utils.rs @@ -177,7 +177,22 @@ ul { ConfigOptions::default(), ) .unwrap(); - snap!(a); + insta::assert_snapshot!(a, @r#" + + + +

swag

+

abc

+

love

+

3

+ "#); Ok(()) } } From c90bc2e8bc40bfe794fa8d5930807140ee0670eb Mon Sep 17 00:00:00 2001 From: Laith Date: Tue, 29 Sep 2026 20:54:33 -0400 Subject: [PATCH 8/8] feat(test/exporter): use inline snapshots instead of assert_eq's when in rome --- crates/org-exporter/src/html.rs | 491 ++++++++++++++------------------ crates/org-exporter/src/org.rs | 289 +++++++------------ 2 files changed, 326 insertions(+), 454 deletions(-) diff --git a/crates/org-exporter/src/html.rs b/crates/org-exporter/src/html.rs index 18e135a..071d929 100644 --- a/crates/org-exporter/src/html.rs +++ b/crates/org-exporter/src/html.rs @@ -984,11 +984,7 @@ mod tests { ", ); - assert_eq!( - a, - r"

hiii cool three text

-" - ); + insta::assert_snapshot!(a, @"

hiii cool three text

"); } #[test] @@ -1000,11 +996,7 @@ mod tests { ", ); - assert_eq!( - a, - r"

hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

-", - ); + insta::assert_snapshot!(a, @"

hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

"); } #[test] @@ -1014,24 +1006,18 @@ mod tests { ", ); - assert_eq!( - a, - r"

abc -
-

-", - ); + insta::assert_snapshot!(a, @" +

abc +
+

+ "); let n = html_export( r" abc\\ q ", ); - assert_eq!( - n, - r"

abc\\ q

-", - ); + insta::assert_snapshot!(n, @r"

abc\\ q

"); } #[test] @@ -1060,11 +1046,7 @@ mod tests { ", ); - assert_eq!( - nb, - r"

----

-", - ); + insta::assert_snapshot!(nb, @"

----

"); } #[test] @@ -1097,11 +1079,7 @@ abc &+ 10\\ ", ); - assert_eq!( - a, - r"

a é😳

-" - ); + insta::assert_snapshot!(a, @"

a é😳

"); } #[test] @@ -1112,14 +1090,12 @@ abc &+ 10\\ ", ); - assert_eq!( - a, - r#"
    -
  1. wordsss??

    -
  2. -
-"#, - ); + insta::assert_snapshot!(a, @r#" +
    +
  1. wordsss??

    +
  2. +
+ "#); } #[test] fn anon_footnote() { @@ -1129,32 +1105,31 @@ hi [fn:next:coolio] yeah [fn:next] ", ); // just codifying what the output is here, not supposed to be set in stone - assert_eq!( - a, - r##"

hi - 1 - yeah - 1 -

- -
- -

Footnotes

-
- - -
- - 1 - -coolio
-
-
"## - ); + insta::assert_snapshot!(a, @r##" +

hi + 1 + yeah + 1 +

+ +
+ +

Footnotes

+
+ + +
+ + 1 + + coolio
+
+
+ "##); } #[test] @@ -1170,31 +1145,30 @@ hello [fn:1] ); // just codifying what the output is here, not supposed to be set in stone - assert_eq!( - a, - r##"

hello - 1 -

-

Footnotes

- -
- -
- - -
- - 1 - -

world

-
-
-
"## - ); + insta::assert_snapshot!(a, @r##" +

hello + 1 +

+

Footnotes

+ +
+ +
+ + +
+ + 1 + +

world

+
+
+
+ "##); } #[test] @@ -1219,62 +1193,61 @@ novel [fn:next:coolio] // REVIEW; investigate different nodeids with export_buf and export // had to change 1.7 to 1.8 to pass the test - assert_eq!( - a, - r##"

hi - 1 - cool test - 2 - - 1 - coolest - 3 - again - 3 -

-

novel - 4 -

-

Footnotes

- -
- -
- - -
- - 1 - -

abcdef

-
- -
- - 2 - -

words babby

-
- -
- - 3 - -

hi

-
- -
- - 4 - -coolio
-
-
"## - ); + insta::assert_snapshot!(a, @r##" +

hi + 1 + cool test + 2 + + 1 + coolest + 3 + again + 3 +

+

novel + 4 +

+

Footnotes

+ +
+ +
+ + +
+ + 1 + +

abcdef

+
+ +
+ + 2 + +

words babby

+
+ +
+ + 3 + +

hi

+
+ +
+ + 4 + + coolio
+
+
+ "##); } #[test] @@ -1289,51 +1262,46 @@ bad [fn:] ", ); - assert_eq!( - a, - r##"

And anonymous ones - 1 -

-

what - 2 -

-

bad [fn:]

- -
- -

Footnotes

-
- - -
- - 1 - -mysterious
- -
- - 2 - -
-
-
"## - ); + insta::assert_snapshot!(a, @r##" +

And anonymous ones + 1 +

+

what + 2 +

+

bad [fn:]

+ +
+ +

Footnotes

+
+ + +
+ + 1 + + mysterious
+ +
+ + 2 + +
+
+
+ "##); } #[test] fn file_link() { let a = html_export(r"[[file:html.org][hi]]"); - assert_eq!( - a, - r#"

hi

-"# - ); + insta::assert_snapshot!(a, @r#"

hi

"#); } #[test] @@ -1343,13 +1311,11 @@ mysterious [[file:bmc.jpg]] ", ); - assert_eq!( - a, - r#"
-bmc.jpg -
-"# - ); + insta::assert_snapshot!(a, @r#" +
+ bmc.jpg +
+ "#); } #[test] @@ -1360,57 +1326,45 @@ mysterious ", ); - assert_eq!( - a, - r#"
-Org-mode-unicorn.svg -
-"# - ); + insta::assert_snapshot!(a, @r#" +
+ Org-mode-unicorn.svg +
+ "#); } #[test] fn unspecified_link() { let a = html_export(r"[[./hello]]"); - assert_eq!( - a, - r##"

./hello

-"## - ); + insta::assert_snapshot!(a, @r#"

./hello

"#); } #[test] fn checkbox() { let a = html_export("- [X]\n"); - assert_eq!( - a, - r#"
    -
  • -
-"# - ); + insta::assert_snapshot!(a, @r#" +
    +
  • +
+ "#); let b = html_export("- [ ]\n"); - assert_eq!( - b, - r#"
    -
  • -
-"# - ); + insta::assert_snapshot!(b, @r#" +
    +
  • +
+ "#); let c = html_export("- [-]\n"); - assert_eq!( - c, - r#"
    -
  • -
-"# - ); + insta::assert_snapshot!(c, @r#" +
    +
  • +
+ "#); } #[test] @@ -1428,10 +1382,13 @@ content here "#; - assert_eq!( - html_export(a), - "

yeah

\n

hello

\n

hi

\n

content

\n

here

\n" - ); + insta::assert_snapshot!(html_export(a), @r#" +

yeah

+

hello

+

hi

+

content

+

here

+ "#); } #[test] @@ -1441,17 +1398,14 @@ here [[suki.jpg]] "#; - assert_eq!( - html_export(a), - r#"
-
-

yes

-
-suki.jpg -
-"# - ) - } + insta::assert_snapshot!(html_export(a), @r#" +
+
+

yes

+
+ suki.jpg +
+ "#);} #[test] fn tabale_caption() { @@ -1460,21 +1414,18 @@ here |a|b|c "#; - assert_eq!( - html_export(a), - r#" - - - - - - -
-

i am a table

-
abc
-"# - ) - } + insta::assert_snapshot!(html_export(a), @" + + + + + + + +
+

i am a table

+
abc
+ ");} #[test] fn block_src() { @@ -1484,14 +1435,12 @@ here (string-append "hello" name)) #+end_src"#; - assert_eq!( - html_export(org_src), - r#"

-(define hello (name)
-    (string-append "hello" name))
-
-"# - ); + insta::assert_snapshot!(html_export(org_src), @r#" +

+        (define hello (name)
+            (string-append "hello" name))
+        
+ "#); } #[test] @@ -1502,13 +1451,11 @@ here (string-append "hello" name)) #+end_src"#; - assert_eq!( - html_export(org_src), - r#"

-(define hello (name)
-    (string-append "hello" name))
-
-"# - ); + insta::assert_snapshot!(html_export(org_src), @r#" +

+        (define hello (name)
+            (string-append "hello" name))
+        
+ "#); } } diff --git a/crates/org-exporter/src/org.rs b/crates/org-exporter/src/org.rs index ffce0ef..c9e737b 100644 --- a/crates/org-exporter/src/org.rs +++ b/crates/org-exporter/src/org.rs @@ -701,13 +701,10 @@ three ", ); - assert_eq!( - out_str, - r"** one two -three *four* - -" - ); + insta::assert_snapshot!(out_str, @" + ** one two + three *four* + "); } #[test] @@ -724,24 +721,22 @@ three *four* ", ); - assert_eq!( - a, - r" -- one two three -four five six + insta::assert_snapshot!(a, @" -- two -- three -- four -+five -" - ); + - one two three + four five six + + - two + - three + - four + +five + "); } #[test] fn test_link_export() { let out = org_export("[[https://swag.org][self]]"); - assert_eq!(out, "[[https://swag.org][self]]\n"); + insta::assert_snapshot!(out, @"[[https://swag.org][self]]"); } #[test] @@ -936,15 +931,12 @@ more content here this is a pargraph ", ); - assert_eq!( - out, - r"* [#1] abc :c: -** [#1] descendant headline :a:b: -*** [#2] inherit the tags -** [#3] different level -" - ); - println!("{out}"); + insta::assert_snapshot!(out, @" + * [#1] abc :c: + ** [#1] descendant headline :a:b: + *** [#2] inherit the tags + ** [#3] different level + "); } #[test] @@ -961,19 +953,16 @@ more content here this is a pargraph ", ); - println!("{a}"); - assert_eq!( - a, - r" -- one - - two - - three - - four - - five -- six - - seven -" - ); + insta::assert_snapshot!(a, @" + + - one + - two + - three + - four + - five + - six + - seven + "); } #[test] @@ -991,20 +980,17 @@ more content here this is a pargraph ", ); - println!("{a}"); - assert_eq!( - a, - r" -- one - - two -- three - - four -- five - - six - - seven -- eight -" - ); + insta::assert_snapshot!(a, @" + + - one + - two + - three + - four + - five + - six + - seven + - eight + "); } #[test] @@ -1053,15 +1039,13 @@ more content here this is a pargraph ", ); - assert_eq!( - a, - r" -| one | two | | -| three | four | | -| five | six | seven | -| eight | | | -" - ); + insta::assert_snapshot!(a, @" + + | one | two | | + | three | four | | + | five | six | seven | + | eight | | | + "); } #[test] @@ -1079,21 +1063,17 @@ more content here this is a pargraph ", ); - println!("{a}"); - assert_eq!( - a, - r" -| one | two | | | -|-------+--------------+--------+--------+ -| three | four | | | -| five | six | seven | | -| eight | | | | -|-------+--------------+--------+--------+ -| swagg | long the | | | -| okay | _underline_ | ~fake | _fake | -" - ); - // println!("{a}"); + insta::assert_snapshot!(a, @" + + | one | two | | | + |-------+--------------+--------+--------+ + | three | four | | | + | five | six | seven | | + | eight | | | | + |-------+--------------+--------+--------+ + | swagg | long the | | | + | okay | _underline_ | ~fake | _fake | + "); } #[test] @@ -1113,50 +1093,43 @@ more content here this is a pargraph ", ); - assert_eq!( - a, - r" -- zero - | one | two | | | - |-------+--------------+--------+--------+ - | three | four | | | - | five | six | seven | | - | eight | | | | - |-------+--------------+--------+--------+ - | swagg | long the | | | - | okay | _underline_ | ~fake | _fake | -- ten -" - ); + insta::assert_snapshot!(a, @" + + - zero + | one | two | | | + |-------+--------------+--------+--------+ + | three | four | | | + | five | six | seven | | + | eight | | | | + |-------+--------------+--------+--------+ + | swagg | long the | | | + | okay | _underline_ | ~fake | _fake | + - ten + "); } #[test] fn proper_list_indent() { let a = org_export( - r" -- one + r"- one - four - one - two ", ); - assert_eq!( - a, - r" -- one -- four - - one - - two -" - ); + insta::assert_snapshot!(a, @" + - one + - four + - one + - two + "); } #[test] fn heading_list_not() { let a = org_export( - r" -- one + r"- one - four * one ", @@ -1165,104 +1138,65 @@ more content here this is a pargraph // make sure * one is not interpreted as another element of the list, // instead as a separate heading (if it was another element, we'd have three -'s // ) - assert_eq!( - a, - r" -- one -- four -* one -" - ); + insta::assert_snapshot!(a, @" + - one + - four + * one + "); } #[test] fn proper_link() { let a = org_export(r"[[abc][one]]"); - assert_eq!( - a, - r"[[abc][one]] -" - ); + insta::assert_snapshot!(a, @"[[abc][one]]"); } #[test] fn link_odd() { let a = org_export("[aayyyy][one]]"); - assert_eq!( - a, - r"[aayyyy][one]] -" - ); + insta::assert_snapshot!(a, @"[aayyyy][one]]"); } #[test] fn superscript() { let a = org_export(r"sample_text^{\gamma}"); - assert_eq!( - a, - r"sample_{text}^{γ} -" - ); + insta::assert_snapshot!(a, @"sample_{text}^{γ}"); let b = org_export( r"sample_text^bunchoftextnowhite!,lkljas after", ); - assert_eq!( - b, - r"sample_{text}^{bunchoftextnowhite}!,lkljas after -" - ); + insta::assert_snapshot!(b, @"sample_{text}^{bunchoftextnowhite}!,lkljas after"); let c = org_export(r"nowhere ^texto"); - assert_eq!( - c, - r"nowhere ^texto -" - ); + insta::assert_snapshot!(c, @"nowhere ^texto"); } #[test] fn subscript() { let a = org_export(r"sample_text_{\gamma}"); - assert_eq!( - a, - r"sample_{text}_{γ} -" - ); + insta::assert_snapshot!(a, @"sample_{text}_{γ}"); let b = org_export( r"sample_{text}_bunchoftextnowhite!,lkljas after", ); - assert_eq!( - b, - r"sample_{text}_{bunchoftextnowhite}!,lkljas after -" - ); + insta::assert_snapshot!(b, @"sample_{text}_{bunchoftextnowhite}!,lkljas after"); let c = org_export(r"nowhere _texto"); - assert_eq!( - c, - r"nowhere _texto -" - ); + insta::assert_snapshot!(c, @"nowhere _texto"); } #[test] fn plain_link() { let a = org_export("https://cool.com abc rest"); - assert_eq!( - a, - "[[https://cool.com]] abc rest -" - ); + insta::assert_snapshot!(a, @"[[https://cool.com]] abc rest"); } #[test] @@ -1273,12 +1207,10 @@ more content here this is a pargraph ", ); - assert_eq!( - a, - r"- test =if ~literal $interpreters \[handle newline \(properly {{{in(a lists -- text that isn't disappearing! -" - ); + insta::assert_snapshot!(a, @r" + - test =if ~literal $interpreters \[handle newline \(properly {{{in(a lists + - text that isn't disappearing! + "); } #[test] @@ -1309,11 +1241,7 @@ wow? fn markup_enclosed_in_bracks() { let a = org_export(r"[_enclosed text here_]"); - assert_eq!( - a, - "[_enclosed text here_] -" - ); + insta::assert_snapshot!(a, @"[_enclosed text here_]"); } #[test] @@ -1334,23 +1262,20 @@ four :end: ", ); - assert_eq!( - a, - r" -:NAME: + insta::assert_snapshot!(a, @" -*words* + :NAME: -| | | | abcds | + *words* + | | | | abcds | -* abc one two three -four -:end: + * abc one two three -" - ); + four + :end: + "); } }