diff options
-rw-r--r-- | tests/misc_zero.rs | 25 |
1 files changed, 25 insertions, 0 deletions
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"), + "<p>asd�asd</p>", + "should replace `\\0` w/ a replacement characters (`�`)" + ); + + assert_eq!( + micromark("�"), + "<p>�</p>", + "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"), + "<p>\\0</p>", + "should not support NUL in a character escape" + ); +} |