Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
  • Loading branch information
zhiburt committed Mar 29, 2023
1 parent 5681ede commit 976028f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
21 changes: 2 additions & 19 deletions src/session/async_session.rs
Expand Up @@ -146,8 +146,8 @@ impl<P, S: AsyncRead + Unpin> Session<P, S> {
/// But its strategy of matching is different from it.
/// It makes search agains all bytes available.
///
#[cfg_attr(windows, doc = "```no_run")]
#[cfg_attr(unix, doc = "```")]
#[cfg_attr(any(target_os = "macos", windows), doc = "```no_run")]
#[cfg_attr(not(any(target_os = "macos", windows)), doc = "```")]
/// # futures_lite::future::block_on(async {
/// let mut p = expectrl::spawn("echo 123").unwrap();
/// // wait to guarantee that check will successed (most likely)
Expand Down Expand Up @@ -454,23 +454,6 @@ impl<S: AsyncRead + Unpin> Stream<S> {

/// Check checks if a pattern is matched.
/// Returns empty found structure if nothing found.
///
/// Is a non blocking version of [Session::expect].
/// But its strategy of matching is different from it.
/// It makes search agains all bytes available.
///
#[cfg_attr(windows, doc = "```no_run")]
#[cfg_attr(unix, doc = "```")]
/// # futures_lite::future::block_on(async {
/// #
/// let mut p = expectrl::spawn("echo 123").unwrap();
/// // wait to guarantee that check will successed (most likely)
/// std::thread::sleep(std::time::Duration::from_secs(1));
/// let m = p.check(expectrl::Regex("\\d+")).await.unwrap();
/// assert_eq!(m.get(0).unwrap(), b"123");
/// #
/// # });
/// ```
async fn check<E: Needle>(&mut self, needle: E) -> Result<Captures, Error> {
let eof = self.try_fill().await?;

Expand Down
2 changes: 1 addition & 1 deletion src/session/sync_session.rs
Expand Up @@ -248,7 +248,7 @@ impl<P, S: Read + NonBlocking> Session<P, S> {
/// # Example
///
#[cfg_attr(any(windows, target_os = "macos"), doc = "```no_run")]
#[cfg_attr(target_os = "linux", doc = "```")]
#[cfg_attr(not(any(target_os = "macos", windows)), doc = "```")]
/// use expectrl::{spawn, Regex};
/// use std::time::Duration;
///
Expand Down
5 changes: 1 addition & 4 deletions tests/repl.rs
Expand Up @@ -23,10 +23,7 @@ fn bash() {

p.send(ControlCode::EOT).unwrap();

assert_eq!(
p.get_process().wait().unwrap(),
WaitStatus::Exited(p.get_process().pid(), 0)
);
p.get_process_mut().exit(true).unwrap();
}

#[cfg(not(feature = "async"))]
Expand Down

0 comments on commit 976028f

Please sign in to comment.