diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-30 14:04:10 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-30 14:04:10 -0500 |
commit | 0eaa0416fe949d8b3f5273f2677725b113ce17d0 (patch) | |
tree | 695f41a4ed475af6ffb7890fa5c680ff709d37f7 /tests/winch.rs | |
parent | 757cc7b4e5223caf6092d014b929955daa6623a4 (diff) | |
download | pty-process-0eaa0416fe949d8b3f5273f2677725b113ce17d0.tar.gz pty-process-0eaa0416fe949d8b3f5273f2677725b113ce17d0.zip |
don't need to test all frameworks in every test
Diffstat (limited to 'tests/winch.rs')
-rw-r--r-- | tests/winch.rs | 68 |
1 files changed, 1 insertions, 67 deletions
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); - }); -} |