From: Thomas Lamprecht Date: Fri, 23 Feb 2024 16:19:15 +0000 (+0100) Subject: fqdn comparison: expand test scope X-Git-Url: https://git.proxmox.com/?p=pve-installer.git;a=commitdiff_plain;h=9466865843d9cb122c8e10b7761e33d169d95bd2 fqdn comparison: expand test scope Add some negative tests to ensure a `return true` (exaggerated) refactoring won't pass the suite, and add one test where a and b is the same, just to be sure. Signed-off-by: Thomas Lamprecht --- diff --git a/proxmox-installer-common/src/utils.rs b/proxmox-installer-common/src/utils.rs index ddfd7a1..8d32075 100644 --- a/proxmox-installer-common/src/utils.rs +++ b/proxmox-installer-common/src/utils.rs @@ -338,7 +338,11 @@ mod tests { #[test] fn fqdn_compare() { + assert_eq!(Fqdn::from("example.com"), Fqdn::from("example.com")); assert_eq!(Fqdn::from("example.com"), Fqdn::from("ExAmPle.Com")); assert_eq!(Fqdn::from("ExAmPle.Com"), Fqdn::from("example.com")); + assert_ne!(Fqdn::from("subdomain.ExAmPle.Com"), Fqdn::from("example.com")); + assert_ne!(Fqdn::from("foo.com"), Fqdn::from("bar.com")); + assert_ne!(Fqdn::from("example.com"), Fqdn::from("example.net")); } }