Fix Windows test error

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2023-09-24 13:25:09 -07:00
parent a66715072f
commit 7756cb4552
No known key found for this signature in database
GPG Key ID: 397D2B00FEA368AA
1 changed files with 9 additions and 4 deletions

View File

@ -1323,6 +1323,11 @@ mod test {
cmd cmd
} }
#[cfg(unix)]
const OUTPUT: &[u8] = b"hello\n";
#[cfg(windows)]
const OUTPUT: &[u8] = b"hello\r\n";
future::block_on(async { future::block_on(async {
// Thread should not be spawned off the bat. // Thread should not be spawned off the bat.
assert!(!is_thread_spawned()); assert!(!is_thread_spawned());
@ -1338,7 +1343,7 @@ mod test {
} }
.or(async { .or(async {
let output = command().output().await.unwrap(); let output = command().output().await.unwrap();
assert_eq!(output.stdout, b"hello\n"); assert_eq!(output.stdout, OUTPUT);
}) })
.await; .await;
assert!(!is_thread_spawned()); assert!(!is_thread_spawned());
@ -1357,7 +1362,7 @@ mod test {
}) })
.or(async { .or(async {
let output = command().output().await.unwrap(); let output = command().output().await.unwrap();
assert_eq!(output.stdout, b"hello\n"); assert_eq!(output.stdout, OUTPUT);
}) })
.await; .await;
assert!(!is_thread_spawned()); assert!(!is_thread_spawned());
@ -1372,7 +1377,7 @@ mod test {
} }
.or(async { .or(async {
let output = command().output().await.unwrap(); let output = command().output().await.unwrap();
assert_eq!(output.stdout, b"hello\n"); assert_eq!(output.stdout, OUTPUT);
}) })
.await; .await;
assert!(!is_thread_spawned()); assert!(!is_thread_spawned());
@ -1385,7 +1390,7 @@ mod test {
// We should now be able to poll the process future independently, it will spawn the // We should now be able to poll the process future independently, it will spawn the
// thread. // thread.
let output = command().output().await.unwrap(); let output = command().output().await.unwrap();
assert_eq!(output.stdout, b"hello\n"); assert_eq!(output.stdout, OUTPUT);
assert!(is_thread_spawned()); assert!(is_thread_spawned());
}); });
} }