aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-03-09 16:02:43 +0100
committerGitHub <noreply@github.com>2026-03-09 16:02:43 +0100
commit780784ab761425386df7a16d06337b31b0479847 (patch)
tree381914054e350e8e4427fb3dc8477a82b30c2f4e /src/tests
parentUpdate CHANGELOG.md (diff)
downloadsl0ppij-780784ab761425386df7a16d06337b31b0479847.tar.gz
sl0ppij-780784ab761425386df7a16d06337b31b0479847.tar.xz
sl0ppij-780784ab761425386df7a16d06337b31b0479847.zip
allow specifying ip/port with the zellij web --status cli (#4825)
* allow specifying ip/port with the zellij web --status cli * add pr
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cli.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/cli.rs b/src/tests/cli.rs
index 95864d56..12d8ca6d 100644
--- a/src/tests/cli.rs
+++ b/src/tests/cli.rs
@@ -1,3 +1,5 @@
+use std::net::{IpAddr, Ipv4Addr};
+
use clap::Parser;
use zellij_utils::cli::{CliArgs, Command};
@@ -67,3 +69,54 @@ fn web_cli_status_with_stop_fails() {
let args = CliArgs::try_parse_from(["zellij", "web", "--status", "--stop"]);
assert!(args.is_err());
}
+
+#[test]
+fn web_cli_status_with_ip_works() {
+ let args = CliArgs::try_parse_from(["zellij", "web", "--status", "--ip", "127.0.0.1"]);
+ assert!(args.is_ok());
+ if let Ok(CliArgs {
+ command: Some(Command::Web(web)),
+ ..
+ }) = args
+ {
+ assert!(web.status);
+ assert_eq!(web.ip, Some(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))));
+ } else {
+ panic!("Expected Web command");
+ }
+}
+
+#[test]
+fn web_cli_status_with_port_works() {
+ let args = CliArgs::try_parse_from(["zellij", "web", "--status", "--port", "9000"]);
+ assert!(args.is_ok());
+ if let Ok(CliArgs {
+ command: Some(Command::Web(web)),
+ ..
+ }) = args
+ {
+ assert!(web.status);
+ assert_eq!(web.port, Some(9000));
+ } else {
+ panic!("Expected Web command");
+ }
+}
+
+#[test]
+fn web_cli_status_with_ip_and_port_works() {
+ let args = CliArgs::try_parse_from([
+ "zellij", "web", "--status", "--ip", "0.0.0.0", "--port", "9000",
+ ]);
+ assert!(args.is_ok());
+ if let Ok(CliArgs {
+ command: Some(Command::Web(web)),
+ ..
+ }) = args
+ {
+ assert!(web.status);
+ assert_eq!(web.ip, Some(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0))));
+ assert_eq!(web.port, Some(9000));
+ } else {
+ panic!("Expected Web command");
+ }
+}