changeset 7:9731ff589d9c

Fix tests on non-linux systems We need to check that systemd tests fail on non-linux systems instead.
author Martin Habovstiak <martin.habovstiak@gmail.com>
date Fri, 27 Nov 2020 16:29:09 +0100
parents a7893294e9b2
children 372afb9a700f
files src/lib.rs tests/systemd.rs
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib.rs	Fri Nov 27 16:15:57 2020 +0100
+++ b/src/lib.rs	Fri Nov 27 16:29:09 2020 +0100
@@ -383,11 +383,19 @@
     }
 
     #[test]
+    #[cfg(linux)]
     fn parse_systemd() {
         assert_eq!("systemd://foo".parse::<SocketAddr>().unwrap().0, SocketAddrInner::Systemd("systemd://foo".to_owned()));
     }
 
     #[test]
+    #[cfg(not(linux))]
+    #[should_panic]
+    fn parse_systemd() {
+        "systemd://foo".parse::<SocketAddr>().unwrap();
+    }
+
+    #[test]
     #[should_panic]
     fn parse_systemd_fail_control() {
         "systemd://foo\n".parse::<SocketAddr>().unwrap();
--- a/tests/systemd.rs	Fri Nov 27 16:15:57 2020 +0100
+++ b/tests/systemd.rs	Fri Nov 27 16:29:09 2020 +0100
@@ -23,6 +23,7 @@
 }
 
 #[test]
+#[cfg_attr(not(linux), should_panic)]
 fn main() {
     comm::main::<Test>();
 }