Skip to content

Commit

Permalink
Replace test escaped_characters with escape::test_escape
Browse files Browse the repository at this point in the history
The test in xmlrs_reader_tests.rs actually calls `unescape` function to get resulting
strings that is matched in the test, so we just test that function instead
  • Loading branch information
Mingun committed Jun 21, 2024
1 parent 625c74e commit e9cab59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/escape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,10 @@ fn test_unescape() {
assert_eq!(unchanged, Cow::Borrowed("test"));
assert!(matches!(unchanged, Cow::Borrowed(_)));

assert_eq!(unescape("&lt;test&gt;").unwrap(), "<test>");
assert_eq!(
unescape("&lt;&amp;test&apos;&quot;&gt;").unwrap(),
"<&test'\">"
);
assert_eq!(unescape("&#x30;").unwrap(), "0");
assert_eq!(unescape("&#48;").unwrap(), "0");
assert!(unescape("&foo;").is_err());
Expand Down
14 changes: 0 additions & 14 deletions tests/xmlrs_reader_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@ fn html5() {
);
}

#[test]
fn escaped_characters() {
test(
r#"<e attr="&quot;Hello&quot;">&apos;a&apos; &lt; &apos;&amp;&apos;</e>"#,
r#"
|StartElement(e [attr=""Hello""])
|Characters('a' < '&')
|EndElement(e)
|EndDocument
"#,
true,
)
}

#[cfg(feature = "escape-html")]
#[test]
fn escaped_characters_html() {
Expand Down

0 comments on commit e9cab59

Please sign in to comment.