From 8c8f0a4dbfcbde9a6155af0b956c1767a176f07c Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 21 Apr 2025 19:09:26 -0700 Subject: [PATCH] Add test for smart punctuation --- tests/testsuite/markdown.rs | 36 +++++++++++++++++++ .../markdown/smart_punctuation/src/SUMMARY.md | 1 + .../src/smart_punctuation.md | 7 ++++ 3 files changed, 44 insertions(+) create mode 100644 tests/testsuite/markdown/smart_punctuation/src/SUMMARY.md create mode 100644 tests/testsuite/markdown/smart_punctuation/src/smart_punctuation.md diff --git a/tests/testsuite/markdown.rs b/tests/testsuite/markdown.rs index 61317e6b..50471826 100644 --- a/tests/testsuite/markdown.rs +++ b/tests/testsuite/markdown.rs @@ -108,3 +108,39 @@ Carrots "##]], ); } + +// Smart punctuation test. +#[test] +fn smart_punctuation() { + BookTest::from_dir("markdown/smart_punctuation") + // Default is off. + .check_main_file( + "book/smart_punctuation.html", + str![[r##" +

Smart Punctuation

+ +"##]], + ) + .run("build", |cmd| { + cmd.env("MDBOOK_OUTPUT__HTML__SMART_PUNCTUATION", "true"); + }) + .check_main_file( + "book/smart_punctuation.html", + str![[r##" +

Smart Punctuation

+ +"##]], + ); +} diff --git a/tests/testsuite/markdown/smart_punctuation/src/SUMMARY.md b/tests/testsuite/markdown/smart_punctuation/src/SUMMARY.md new file mode 100644 index 00000000..7ec259e3 --- /dev/null +++ b/tests/testsuite/markdown/smart_punctuation/src/SUMMARY.md @@ -0,0 +1 @@ +- [Smart Punctuation](smart_punctuation.md) diff --git a/tests/testsuite/markdown/smart_punctuation/src/smart_punctuation.md b/tests/testsuite/markdown/smart_punctuation/src/smart_punctuation.md new file mode 100644 index 00000000..a27f3c32 --- /dev/null +++ b/tests/testsuite/markdown/smart_punctuation/src/smart_punctuation.md @@ -0,0 +1,7 @@ +# Smart Punctuation + +- En dash: -- +- Em dash: --- +- Ellipsis: ... +- Double quote: "quote" +- Single quote: 'quote'