2021-08-06 03:54:23 -04:00
|
|
|
use crate::spec::entity::encode::encode_ampersands;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_encode_ampersands_works_for_content() {
|
2021-08-06 06:16:30 -04:00
|
|
|
let out = encode_ampersands(b"1 is < &than 2 Y&&ClockwiseContourIntegral", false);
|
|
|
|
assert_eq!(
|
|
|
|
std::str::from_utf8(&out).unwrap(),
|
|
|
|
"1 is < &than 2 Y&amp;&ClockwiseContourIntegral"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_encode_ampersands_works_for_attr() {
|
|
|
|
let out = encode_ampersands(b"https://a.com/b?c=d¶m=123¶m;<—", true);
|
|
|
|
assert_eq!(
|
|
|
|
std::str::from_utf8(&out).unwrap(),
|
|
|
|
"https://a.com/b?c=d¶m=123¶m;&lt&mdash;"
|
|
|
|
);
|
2021-08-06 03:54:23 -04:00
|
|
|
}
|