test(cli): add integration tests for disabled client feature
Verify that the CLI correctly reports the unavailability of the client applet and provides instructions on how to enable it via features.
This commit is contained in:
1 parent
baa2a862f5
commit
c5ca3d5a93
1 file changed
+31
@@ -44,6 +44,7 @@ fn canonical_without_applet_errors() {
|
||||
assert!(text.contains("server"));
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[test]
|
||||
fn canonical_client_subcommand_dispatches_to_client() {
|
||||
let output = irtt_rs().args(["client", "--help"]).output().unwrap();
|
||||
@@ -55,7 +56,21 @@ fn canonical_client_subcommand_dispatches_to_client() {
|
||||
assert!(text.contains("--columns <COLUMNS>"));
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "client"))]
|
||||
#[test]
|
||||
fn canonical_client_subcommand_reports_unavailable_when_disabled() {
|
||||
let output = irtt_rs().args(["client", "--help"]).output().unwrap();
|
||||
let text = output_text(&output);
|
||||
|
||||
assert!(!output.status.success());
|
||||
assert!(
|
||||
text.contains("client applet is not available; rebuild with the client feature"),
|
||||
"{text}"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(feature = "client")]
|
||||
#[test]
|
||||
fn client_applet_name_dispatches_to_client() {
|
||||
let output = irtt_rs_with_arg0("irtt-cli")
|
||||
@@ -70,6 +85,22 @@ fn client_applet_name_dispatches_to_client() {
|
||||
assert!(text.contains("--columns <COLUMNS>"));
|
||||
}
|
||||
|
||||
#[cfg(all(unix, not(feature = "client")))]
|
||||
#[test]
|
||||
fn client_applet_name_reports_unavailable_when_disabled() {
|
||||
let output = irtt_rs_with_arg0("irtt-cli")
|
||||
.arg("--help")
|
||||
.output()
|
||||
.unwrap();
|
||||
let text = output_text(&output);
|
||||
|
||||
assert!(!output.status.success());
|
||||
assert!(
|
||||
text.contains("client applet is not available; rebuild with the client feature"),
|
||||
"{text}"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(all(unix, feature = "tui"))]
|
||||
#[test]
|
||||
fn tui_applet_name_dispatches_to_tui_when_enabled() {
|
||||
|
||||
Reference in new issue
Block a user