aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-15 14:00:29 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-06-15 14:00:29 +0200
commit75dcb48f78a8a798fde525d2d39e20cffec48e50 (patch)
tree546450a3e55c190e289e8c8362e0b21ea59334fe /tests
parentb020566ae369bef1116b7ea91d62884116be73d5 (diff)
downloadmarkdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.tar.gz
markdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.tar.bz2
markdown-rs-75dcb48f78a8a798fde525d2d39e20cffec48e50.zip
Add tests for nul
Diffstat (limited to 'tests')
-rw-r--r--tests/misc_zero.rs25
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("&#0;"),
+ "<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"
+ );
+}