diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
commit | ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a (patch) | |
tree | 2da4be3be22c2324c48cb17133b3f4b26b9139d2 /tests/misc_dangerous_protocol.rs | |
parent | 861af95c119721e814460fa7dc32bd3d74b38484 (diff) | |
download | markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.gz markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.bz2 markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.zip |
Rename crate to `markdown`
Diffstat (limited to '')
-rw-r--r-- | tests/misc_dangerous_protocol.rs | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/tests/misc_dangerous_protocol.rs b/tests/misc_dangerous_protocol.rs index 0c25eba..1703d60 100644 --- a/tests/misc_dangerous_protocol.rs +++ b/tests/misc_dangerous_protocol.rs @@ -1,35 +1,35 @@ -extern crate micromark; -use micromark::micromark; +extern crate markdown; +use markdown::to_html; use pretty_assertions::assert_eq; #[test] fn dangerous_protocol_autolink() { assert_eq!( - micromark("<javascript:alert(1)>"), + to_html("<javascript:alert(1)>"), "<p><a href=\"\">javascript:alert(1)</a></p>", "should be safe by default" ); assert_eq!( - micromark("<http://a>"), + to_html("<http://a>"), "<p><a href=\"http://a\">http://a</a></p>", "should allow `http:`" ); assert_eq!( - micromark("<https://a>"), + to_html("<https://a>"), "<p><a href=\"https://a\">https://a</a></p>", "should allow `https:`" ); assert_eq!( - micromark("<irc:///help>"), + to_html("<irc:///help>"), "<p><a href=\"irc:///help\">irc:///help</a></p>", "should allow `irc:`" ); assert_eq!( - micromark("<mailto:a>"), + to_html("<mailto:a>"), "<p><a href=\"mailto:a\">mailto:a</a></p>", "should allow `mailto:`" ); @@ -38,79 +38,79 @@ fn dangerous_protocol_autolink() { #[test] fn dangerous_protocol_image() { assert_eq!( - micromark("![](javascript:alert(1))"), + to_html("![](javascript:alert(1))"), "<p><img src=\"\" alt=\"\" /></p>", "should be safe by default" ); assert_eq!( - micromark("![](http://a)"), + to_html("![](http://a)"), "<p><img src=\"http://a\" alt=\"\" /></p>", "should allow `http:`" ); assert_eq!( - micromark("![](https://a)"), + to_html("![](https://a)"), "<p><img src=\"https://a\" alt=\"\" /></p>", "should allow `https:`" ); assert_eq!( - micromark("![](irc:///help)"), + to_html("![](irc:///help)"), "<p><img src=\"\" alt=\"\" /></p>", "should not allow `irc:`" ); assert_eq!( - micromark("![](mailto:a)"), + to_html("![](mailto:a)"), "<p><img src=\"\" alt=\"\" /></p>", "should not allow `mailto:`" ); assert_eq!( - micromark("![](#a)"), + to_html("![](#a)"), "<p><img src=\"#a\" alt=\"\" /></p>", "should allow a hash" ); assert_eq!( - micromark("![](?a)"), + to_html("![](?a)"), "<p><img src=\"?a\" alt=\"\" /></p>", "should allow a search" ); assert_eq!( - micromark("![](/a)"), + to_html("![](/a)"), "<p><img src=\"/a\" alt=\"\" /></p>", "should allow an absolute" ); assert_eq!( - micromark("![](./a)"), + to_html("![](./a)"), "<p><img src=\"./a\" alt=\"\" /></p>", "should allow an relative" ); assert_eq!( - micromark("![](../a)"), + to_html("![](../a)"), "<p><img src=\"../a\" alt=\"\" /></p>", "should allow an upwards relative" ); assert_eq!( - micromark("![](a#b:c)"), + to_html("![](a#b:c)"), "<p><img src=\"a#b:c\" alt=\"\" /></p>", "should allow a colon in a hash" ); assert_eq!( - micromark("![](a?b:c)"), + to_html("![](a?b:c)"), "<p><img src=\"a?b:c\" alt=\"\" /></p>", "should allow a colon in a search" ); assert_eq!( - micromark("![](a/b:c)"), + to_html("![](a/b:c)"), "<p><img src=\"a/b:c\" alt=\"\" /></p>", "should allow a colon in a path" ); @@ -119,79 +119,79 @@ fn dangerous_protocol_image() { #[test] fn dangerous_protocol_link() { assert_eq!( - micromark("[](javascript:alert(1))"), + to_html("[](javascript:alert(1))"), "<p><a href=\"\"></a></p>", "should be safe by default" ); assert_eq!( - micromark("[](http://a)"), + to_html("[](http://a)"), "<p><a href=\"http://a\"></a></p>", "should allow `http:`" ); assert_eq!( - micromark("[](https://a)"), + to_html("[](https://a)"), "<p><a href=\"https://a\"></a></p>", "should allow `https:`" ); assert_eq!( - micromark("[](irc:///help)"), + to_html("[](irc:///help)"), "<p><a href=\"irc:///help\"></a></p>", "should allow `irc:`" ); assert_eq!( - micromark("[](mailto:a)"), + to_html("[](mailto:a)"), "<p><a href=\"mailto:a\"></a></p>", "should allow `mailto:`" ); assert_eq!( - micromark("[](#a)"), + to_html("[](#a)"), "<p><a href=\"#a\"></a></p>", "should allow a hash" ); assert_eq!( - micromark("[](?a)"), + to_html("[](?a)"), "<p><a href=\"?a\"></a></p>", "should allow a search" ); assert_eq!( - micromark("[](/a)"), + to_html("[](/a)"), "<p><a href=\"/a\"></a></p>", "should allow an absolute" ); assert_eq!( - micromark("[](./a)"), + to_html("[](./a)"), "<p><a href=\"./a\"></a></p>", "should allow an relative" ); assert_eq!( - micromark("[](../a)"), + to_html("[](../a)"), "<p><a href=\"../a\"></a></p>", "should allow an upwards relative" ); assert_eq!( - micromark("[](a#b:c)"), + to_html("[](a#b:c)"), "<p><a href=\"a#b:c\"></a></p>", "should allow a colon in a hash" ); assert_eq!( - micromark("[](a?b:c)"), + to_html("[](a?b:c)"), "<p><a href=\"a?b:c\"></a></p>", "should allow a colon in a search" ); assert_eq!( - micromark("[](a/b:c)"), + to_html("[](a/b:c)"), "<p><a href=\"a/b:c\"></a></p>", "should allow a colon in a path" ); |