minify-html/src/spec/entity/tests/encode.rs

20 lines
605 B
Rust
Raw Normal View History

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&amp;&ClockwiseContourIntegral", false);
assert_eq!(
std::str::from_utf8(&out).unwrap(),
"1 is < &than 2 Y&ampamp;&ClockwiseContourIntegral"
);
}
#[test]
fn test_encode_ampersands_works_for_attr() {
let out = encode_ampersands(b"https://a.com/b?c=d&param=123&param;&lt&mdash;", true);
assert_eq!(
std::str::from_utf8(&out).unwrap(),
"https://a.com/b?c=d&param=123&param;&amplt&ampmdash;"
);
2021-08-06 03:54:23 -04:00
}