From 420c3039212311f5af6c7943021c3d3f3a65a7a1 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 30 Mar 2024 08:31:01 -0700 Subject: [PATCH] ci: Add a test that sleeps I think this catches errors in notification for the Linux backend. Signed-off-by: John Nunley --- tests/sleep.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/sleep.rs diff --git a/tests/sleep.rs b/tests/sleep.rs new file mode 100644 index 0000000..44eea4e --- /dev/null +++ b/tests/sleep.rs @@ -0,0 +1,26 @@ +//! Sleep test. + +use async_process::Command; +use futures_lite::future::block_on; + +#[cfg(unix)] +#[test] +fn unix_sleep() { + block_on(async { + let status = Command::new("sleep").arg("1").status().await.unwrap(); + assert!(status.success()); + }); +} + +#[cfg(windows)] +#[test] +fn windows_sleep() { + block_on(async { + let status = Command::new("ping") + .args(["-n", "5", "127.0.0.1"]) + .status() + .await + .unwrap(); + assert!(status.success()); + }); +}