diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 14:00:29 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-15 14:00:29 +0200 |
commit | 75dcb48f78a8a798fde525d2d39e20cffec48e50 (patch) | |
tree | 546450a3e55c190e289e8c8362e0b21ea59334fe /tests/misc_zero.rs | |
parent | b020566ae369bef1116b7ea91d62884116be73d5 (diff) | |
download | markdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.tar.gz markdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.tar.bz2 markdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.zip |
Add tests for nul
Diffstat (limited to 'tests/misc_zero.rs')
-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" + ); +} |