mirror of
https://github.com/chatmail/core.git
synced 2026-05-24 09:16:32 +03:00
add some tests for addr_cmp()
This commit is contained in:
committed by
Floris Bruynooghe
parent
63e3c82f9d
commit
81d069209c
@@ -1087,6 +1087,10 @@ mod tests {
|
|||||||
fn test_normalize_addr() {
|
fn test_normalize_addr() {
|
||||||
assert_eq!(addr_normalize("mailto:john@doe.com"), "john@doe.com");
|
assert_eq!(addr_normalize("mailto:john@doe.com"), "john@doe.com");
|
||||||
assert_eq!(addr_normalize(" hello@world.com "), "hello@world.com");
|
assert_eq!(addr_normalize(" hello@world.com "), "hello@world.com");
|
||||||
|
|
||||||
|
// normalisation preserves case to allow user-defined spelling.
|
||||||
|
// however, case is ignored on addr_cmp()
|
||||||
|
assert_ne!(addr_normalize("John@Doe.com"), "john@doe.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1208,4 +1212,11 @@ mod tests {
|
|||||||
assert_eq!(contact.get_addr(), ""); // we're not configured
|
assert_eq!(contact.get_addr(), ""); // we're not configured
|
||||||
assert!(!contact.is_blocked());
|
assert!(!contact.is_blocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_addr_cmp() {
|
||||||
|
assert!(addr_cmp("AA@AA.ORG", "aa@aa.ORG"));
|
||||||
|
assert!(addr_cmp(" aa@aa.ORG ", "AA@AA.ORG"));
|
||||||
|
assert!(addr_cmp(" mailto:AA@AA.ORG", "Aa@Aa.orG"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user