refactor: remove test redundancy, reduce API surface

- Remove duplicate xml_escape tests from sitemap.rs and feed.rs
  (already tested in escape.rs)
- Make html_escape_into private (only used internally)
This commit is contained in:
Timothy DeHerrera
2026-02-06 00:33:10 -07:00
parent 3faa78aadb
commit c8ddfb444a
3 changed files with 1 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ pub fn html_escape(s: &str) -> String {
/// Escape HTML characters into an existing string.
///
/// This is more efficient when building output incrementally.
pub fn html_escape_into(out: &mut String, s: &str) {
fn html_escape_into(out: &mut String, s: &str) {
for c in s.chars() {
match c {
'&' => out.push_str("&"),

View File

@@ -80,14 +80,3 @@ pub fn generate_atom_feed(
entries,
)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_xml_escape() {
assert_eq!(xml_escape("Hello & World"), "Hello & World");
assert_eq!(xml_escape("<tag>"), "&lt;tag&gt;");
}
}

View File

@@ -93,14 +93,6 @@ fn build_sitemap_xml(entries: &[SitemapEntry]) -> String {
mod tests {
use super::*;
#[test]
fn test_xml_escape() {
assert_eq!(xml_escape("Hello & World"), "Hello &amp; World");
assert_eq!(xml_escape("<tag>"), "&lt;tag&gt;");
assert_eq!(xml_escape("\"quoted\""), "&quot;quoted&quot;");
assert_eq!(xml_escape("it's"), "it&apos;s");
}
#[test]
fn test_build_sitemap_xml_single_entry() {
let entries = vec![SitemapEntry {