]> git.proxmox.com Git - pve-installer.git/commitdiff
fqdn comparison: expand test scope
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Feb 2024 16:19:15 +0000 (17:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Feb 2024 16:29:53 +0000 (17:29 +0100)
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 <t.lamprecht@proxmox.com>
proxmox-installer-common/src/utils.rs

index ddfd7a1e725317bba196ce22dd60160dd206752c..8d320759b518d309307ad853c73592fe128456da 100644 (file)
@@ -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"));
     }
 }