From 75dcb48f78a8a798fde525d2d39e20cffec48e50 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 15 Jun 2022 14:00:29 +0200 Subject: Add tests for nul --- tests/misc_zero.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/misc_zero.rs diff --git a/tests/misc_zero.rs b/tests/misc_zero.rs new file mode 100644 index 0000000..946a3e2 --- /dev/null +++ b/tests/misc_zero.rs @@ -0,0 +1,25 @@ +extern crate micromark; +use micromark::micromark; + +#[test] +fn zero() { + assert_eq!( + micromark("asd\0asd"), + "

asd�asd

", + "should replace `\\0` w/ a replacement characters (`�`)" + ); + + assert_eq!( + micromark("�"), + "

", + "should replace NUL in a character reference" + ); + + // This doesn’t make sense in markdown, as character escapes only work on + // ascii punctuation, but it’s good to demonstrate the behavior. + assert_eq!( + micromark("\\0"), + "

\\0

", + "should not support NUL in a character escape" + ); +} -- cgit