20 lines
605 B
Rust
20 lines
605 B
Rust
use crate::spec::entity::encode::encode_ampersands;
|
|
|
|
#[test]
|
|
fn test_encode_ampersands_works_for_content() {
|
|
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;"
|
|
);
|
|
}
|