Skip to content

Commit 9f7b34a

Browse files
committed
Only run expectrl gix-prompt tests where supported
Two important `gix-prompt` tests simulate interactivity with `expectrl`, which (non-optionally) depends on `ptyprocess`. But the only (families of) Unix-like operating systems that `ptyprocess` currently supports are Linux, FreeBSD, and macOS. The tests that used `expectrl` were previously targeted to all "unix" systems. This narrows them to systems where `target_os` is `linux`, `freebsd`, or `macos`, and conditions the `expectrl` dev dependency on those targets. This way, running the test suite no longer fails to build on other Unix-like systems. (In particular, this fixes the failure on OmniOS, an illumos system. But the problem isn't illumos-specific.)
1 parent db5c9cf commit 9f7b34a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

gix-prompt/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ parking_lot = "0.12.1"
2727
[dev-dependencies]
2828
gix-testtools = { path = "../tests/tools" }
2929
serial_test = { version = "3.1.0", default-features = false }
30+
31+
[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))'.dev-dependencies]
3032
expectrl = "0.7.0"

gix-prompt/tests/prompt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mod ask {
3434
}
3535

3636
#[test]
37-
#[cfg(unix)]
37+
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
3838
fn askpass_only() {
3939
let mut cmd = std::process::Command::new(env!("CARGO"));
4040
cmd.args(["build", "--example", "use-askpass", "--example", "askpass"]);
@@ -48,7 +48,7 @@ mod ask {
4848
}
4949

5050
#[test]
51-
#[cfg(unix)]
51+
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "macos"))]
5252
fn username_password() {
5353
let mut cmd = std::process::Command::new(env!("CARGO"));
5454
cmd.args(["build", "--example", "credentials"]);
@@ -65,7 +65,7 @@ mod ask {
6565
}
6666

6767
#[test]
68-
#[cfg(not(unix))]
68+
#[cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "macos")))]
6969
#[ignore]
7070
fn username_password_not_available() {}
7171
}

0 commit comments

Comments
 (0)