diff --git a/cli/tests/help.rs b/cli/tests/help.rs index aacd67ad..f291bd4f 100644 --- a/cli/tests/help.rs +++ b/cli/tests/help.rs @@ -22,3 +22,25 @@ fn help() { String::from_utf8(output.stdout).unwrap() ); } + +#[test] +fn help_short() { + let long = Command::cargo_bin("watchexec") + .unwrap() + .arg("--help") + .output() + .unwrap(); + + let short = Command::cargo_bin("watchexec") + .unwrap() + .arg("--help") + .output() + .unwrap(); + + assert!(short.status.success(), "-h returns 0"); + assert_eq!(short.stderr, Vec::::new(), "-h stderr is empty"); + assert_eq!( + long.stdout, short.stdout, + "--help and -h output are the same" + ); +} diff --git a/cli/tests/snapshots/help__help_unix.snap b/cli/tests/snapshots/help__help_unix.snap index 06ab89eb..2041c2b0 100644 --- a/cli/tests/snapshots/help__help_unix.snap +++ b/cli/tests/snapshots/help__help_unix.snap @@ -17,7 +17,7 @@ FLAGS: --no-global-ignore Skip auto-loading of global or environment-wide ignore files --no-meta Ignore metadata changes --no-process-group Do not use a process group when running the command - --no-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc.) + --no-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc) -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files -N, --notify Send a desktop notification when the command ends diff --git a/cli/tests/snapshots/help__help_windows.snap b/cli/tests/snapshots/help__help_windows.snap index 627f1c2c..4f16eb29 100644 --- a/cli/tests/snapshots/help__help_windows.snap +++ b/cli/tests/snapshots/help__help_windows.snap @@ -17,7 +17,7 @@ FLAGS: --no-global-ignore Skip auto-loading of global or environment-wide ignore files --no-meta Ignore metadata changes --no-process-group Do not use a process group when running the command - --no-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc.) + --no-ignore Skip auto-loading of project ignore files (.gitignore, .ignore, etc) -n, --no-shell Do not wrap command in a shell. Deprecated: use --shell=none instead. --no-vcs-ignore Skip auto-loading of VCS (Git, etc) ignore files -N, --notify Send a desktop notification when the command ends