From c5ca3d5a93d7d453db650aece04d3ce4e5c1f770 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Fri, 3 Jul 2026 00:57:37 +0700 Subject: [PATCH] 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. --- crates/irtt-cli/tests/applet_dispatch.rs | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/irtt-cli/tests/applet_dispatch.rs b/crates/irtt-cli/tests/applet_dispatch.rs index 72b8bb8..01a2250 100644 --- a/crates/irtt-cli/tests/applet_dispatch.rs +++ b/crates/irtt-cli/tests/applet_dispatch.rs @@ -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 ")); } +#[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 ")); } +#[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() {