//! Tests for the Markdown renderer. //! //! They live here rather than inside the module so that `src/` holds no test //! code, as it does in `apsis-rs`. An integration test is a separate crate and //! reaches only what the library makes public, so the few internal items the //! tests need are opened through `apsis_book::testkit`. use apsis_book::docs::markdown::*; #[test] fn an_inline_formula_is_rendered() { let html = render("The rate is $r$ per second."); assert!(html.contains("$HOME"), "the code span was lost" ); } #[test] fn a_formula_does_not_cross_a_line() { let html = render("A $x$ and\nB $y$."); assert_eq!(html.matches(""), "the fraction was not built"); } #[test] fn renders_headings_and_paragraphs() { let html = render("# Title\n\nSome *text* and **more**.\n"); assert!(html.contains("

Title")); assert!(html.contains("

Some text and more.

")); } #[test] fn renders_tables_with_alignment() { let markdown = "| a | b |\n|---|---|\n| 1 | 2 |\n"; let html = render(markdown); assert!(html.contains("a")); assert!(html.contains("1")); } #[test] fn escapes_code_and_text() { let html = render("Use `a < b` and