use astrogram::normalize::normalize_cp1252_str;
#[test]
fn ascii_unchanged() {
assert_eq!(normalize_cp1252_str("Ada Lovelace"), "Ada Lovelace");
}
#[test]
fn empty_unchanged() {
assert_eq!(normalize_cp1252_str(""), "");
}
#[test]
fn latin1_accents_kept() {
assert_eq!(normalize_cp1252_str("Adèle Haenel"), "Adèle Haenel");
assert_eq!(
normalize_cp1252_str("École Polytechnique"),
"École Polytechnique"
);
}
#[test]
fn cp1252_extras_kept() {
assert_eq!(normalize_cp1252_str("€100"), "€100");
}
#[test]
fn magic_quotes_kept() {
assert_eq!(
normalize_cp1252_str("\u{2018}hello\u{2019}"),
"\u{2018}hello\u{2019}"
); assert_eq!(
normalize_cp1252_str("\u{201C}hello\u{201D}"),
"\u{201C}hello\u{201D}"
); assert_eq!(normalize_cp1252_str("it\u{2019}s"), "it\u{2019}s"); }
#[test]
fn emoji_at_end_stripped() {
assert_eq!(normalize_cp1252_str("Amanda ♒️"), "Amanda");
}
#[test]
fn emoji_in_middle_space_collapsed() {
assert_eq!(normalize_cp1252_str("Emmy 🐋 Komarczyk"), "Emmy Komarczyk");
}
#[test]
fn only_emoji_becomes_empty() {
assert_eq!(normalize_cp1252_str("🌙♒️"), "");
}
#[test]
fn astrological_run_stripped() {
assert_eq!(
normalize_cp1252_str("Amanda Musgrove ♒️🌙❓⬆️"),
"Amanda Musgrove"
);
}
#[test]
fn eclipse_with_symbols() {
assert_eq!(
normalize_cp1252_str("Eclipse 2024.03.13 ℧☾ 24°♍️"),
"Eclipse 2024.03.13 24°"
);
}
#[test]
fn leading_whitespace_trimmed() {
assert_eq!(normalize_cp1252_str(" Ada"), "Ada");
}
#[test]
fn trailing_whitespace_trimmed() {
assert_eq!(normalize_cp1252_str("Ada "), "Ada");
}
#[test]
fn double_space_collapsed() {
assert_eq!(normalize_cp1252_str("Ada Lovelace"), "Ada Lovelace");
}
#[test]
fn tabs_and_newlines_collapsed() {
assert_eq!(normalize_cp1252_str("Ada\t\nLovelace"), "Ada Lovelace");
}