diff --git a/Cargo.lock b/Cargo.lock index 5c17153f..30b15124 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1824,9 +1824,9 @@ dependencies = [ [[package]] name = "snapbox" -version = "0.4.16" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73145a30df4935f50a7b13c1882bce7d194d7071ad0bcc36e7cacbf9ef16e3ec" +checksum = "8269b717f21b142c0377f1e617e80999e3ef6b1c010959b44fd93320722d2cba" dependencies = [ "anstream 0.6.11", "anstyle", @@ -1846,9 +1846,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ccde059aad940984ff696fe8c280900f7ea71a6fb45fce65071a3f2c40b667" +checksum = "e1c4b838b05d15ab22754068cb73500b2f3b07bf09d310e15b27f88160f1de40" dependencies = [ "anstream 0.6.11", ] @@ -2066,7 +2066,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.15", ] [[package]] @@ -2079,14 +2079,27 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.15", +] + +[[package]] +name = "toml_edit" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.1", ] [[package]] name = "trycmd" -version = "0.14.16" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2925e71868a12b173c1eb166018c2d2f9dfaedfcaec747bdb6ea2246785d258e" +checksum = "464edb3603a81a50b4c8f47b11dfade69ef48ffdc0af2f8b194ad87cbda75317" dependencies = [ "glob", "humantime", @@ -2095,7 +2108,7 @@ dependencies = [ "serde", "shlex", "snapbox", - "toml_edit 0.19.14", + "toml_edit 0.22.5", ] [[package]] @@ -2516,6 +2529,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" +dependencies = [ + "memchr", +] + [[package]] name = "xml-rs" version = "0.8.14" diff --git a/Cargo.toml b/Cargo.toml index a039f1f9..07e50dd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,8 +113,8 @@ anstream = "0.6.11" chrono = "0.4.33" [dev-dependencies] -trycmd = "0.14" -snapbox = { version = "0.4.16", features = ["diff"] } +trycmd = "0.15" +snapbox = { version = "0.5.0", features = ["diff"] } [features] default = ["syntax-highlight", "sass", "serve", "html-minifier"] diff --git a/src/syntax_highlight.rs b/src/syntax_highlight.rs index 1c71efbb..4b4d3467 100644 --- a/src/syntax_highlight.rs +++ b/src/syntax_highlight.rs @@ -226,21 +226,6 @@ mod test_syntsx { } "; - const CODEBLOCK_RENDERED: &str = - "
\n\
-         mod \
-         test {\n\
-                 \
-         fn \
-         hello(\
-         arg: int) -> \
-         bool {\n\
-                     \
-         true\n\
-                 }\n\
-             }\n\
-             
\n"; - #[test] fn highlight_block_renders_rust() { let syntax = std::sync::Arc::new(SyntaxHighlight::new()); @@ -257,11 +242,8 @@ mod test_syntsx { )) .unwrap(); let output = template.render(&liquid::Object::new()); - snapbox::assert_eq(CODEBLOCK_RENDERED, output.unwrap()); - } - - const MARKDOWN_RENDERED: &str = - "
\n\
+        let expected =
+        snapbox::str!["
\n\
          mod \
          test {\n\
                  \
@@ -273,8 +255,10 @@ mod test_syntsx {
          true\n\
                  }\n\
              }\n\
-             \n\
-         
\n"; +
\n"]; + + snapbox::assert_eq(expected, output.unwrap()); + } #[test] fn markdown_renders_rust() { @@ -292,7 +276,23 @@ mod test_syntsx { &mut buf, decorate_markdown(parser, syntax, Some("base16-ocean.dark")).unwrap(), ); - snapbox::assert_eq(MARKDOWN_RENDERED, &buf); + let expected = + snapbox::str!["
\n\
+         mod \
+         test {\n\
+                 \
+         fn \
+         hello(\
+         arg: int) -> \
+         bool {\n\
+                     \
+         true\n\
+                 }\n\
+             }\n\
+             \n\
+         
\n"]; + + snapbox::assert_eq(expected, &buf); } } @@ -309,14 +309,6 @@ mod test_raw { } "; - const CODEBLOCK_RENDERED: &str = r#"
mod test {
-        fn hello(arg: int) -> bool {
-            true
-        }
-    }
-
-"#; - #[test] fn codeblock_renders_rust() { let syntax = std::sync::Arc::new(SyntaxHighlight::new()); @@ -333,17 +325,18 @@ mod test_raw { )) .unwrap(); let output = template.render(&liquid::Object::new()); - assert_eq!(output.unwrap(), CODEBLOCK_RENDERED.to_string()); - } - - const MARKDOWN_RENDERED: &str = r#"
mod test {
+        let expected = snapbox::str![
+            r#"
mod test {
         fn hello(arg: int) -> bool {
             true
         }
     }
-
 
-"#; +"# + ]; + + snapbox::assert_eq(expected, output.unwrap()); + } #[test] fn decorate_markdown_renders_rust() { @@ -361,6 +354,17 @@ mod test_raw { &mut buf, decorate_markdown(parser, syntax, Some("base16-ocean.dark")).unwrap(), ); - assert_eq!(buf, MARKDOWN_RENDERED); + let expected = snapbox::str![ + r#"
mod test {
+        fn hello(arg: int) -> bool {
+            true
+        }
+    }
+
+
+"# + ]; + + snapbox::assert_eq(expected, buf); } }