From 0eaa0416fe949d8b3f5273f2677725b113ce17d0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 30 Dec 2021 14:04:10 -0500 Subject: don't need to test all frameworks in every test --- tests/winch.rs | 68 +--------------------------------------------------------- 1 file changed, 1 insertion(+), 67 deletions(-) (limited to 'tests/winch.rs') diff --git a/tests/winch.rs b/tests/winch.rs index 40ffaf4..a189697 100644 --- a/tests/winch.rs +++ b/tests/winch.rs @@ -28,7 +28,7 @@ fn test_winch_std() { #[cfg(feature = "async")] #[test] -fn test_winch_async_std() { +fn test_winch_async() { use async_std::io::prelude::WriteExt as _; use async_std::io::ReadExt as _; @@ -57,69 +57,3 @@ fn test_winch_async_std() { }); assert_eq!(status.code().unwrap(), 0); } - -#[cfg(feature = "async")] -#[test] -fn test_winch_smol() { - use smol::io::{AsyncReadExt as _, AsyncWriteExt as _}; - - let status = smol::block_on(async { - let mut pty = pty_process::Pty::new().unwrap(); - pty.resize(pty_process::Size::new(24, 80)).unwrap(); - let mut child = pty_process::Command::new("perl") - .args(&[ - "-E", - "$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>", - ]) - .spawn(&pty) - .unwrap(); - - let mut buf = [0u8; 1024]; - let bytes = pty.read(&mut buf).await.unwrap(); - assert_eq!(&buf[..bytes], b"started\r\n"); - - pty.resize(pty_process::Size::new(25, 80)).unwrap(); - - let bytes = pty.read(&mut buf).await.unwrap(); - assert_eq!(&buf[..bytes], b"WINCH\r\n"); - - pty.write_all(b"\n").await.unwrap(); - child.status().await.unwrap() - }); - assert_eq!(status.code().unwrap(), 0); -} - -#[cfg(feature = "async")] -#[test] -fn test_winch_tokio() { - use tokio::io::{AsyncReadExt as _, AsyncWriteExt as _}; - use tokio_util::compat::FuturesAsyncReadCompatExt as _; - - async fn async_test_cat_tokio() -> std::process::ExitStatus { - let pty = pty_process::Pty::new().unwrap(); - pty.resize(pty_process::Size::new(24, 80)).unwrap(); - let mut child = pty_process::Command::new("perl") - .args(&[ - "-E", - "$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>", - ]) - .spawn(&pty) - .unwrap(); - - let mut buf = [0u8; 1024]; - let bytes = pty.compat().read(&mut buf).await.unwrap(); - assert_eq!(&buf[..bytes], b"started\r\n"); - - pty.resize(pty_process::Size::new(25, 80)).unwrap(); - - let bytes = pty.compat().read(&mut buf).await.unwrap(); - assert_eq!(&buf[..bytes], b"WINCH\r\n"); - - pty.compat().write_all(b"\n").await.unwrap(); - child.status().await.unwrap() - } - tokio::runtime::Runtime::new().unwrap().block_on(async { - let status = async_test_cat_tokio().await; - assert_eq!(status.code().unwrap(), 0); - }); -} -- cgit v1.2.3-54-g00ecf