From bfee7e45e466dfb2ba5dbd340fb6f8178d5f4c8a Mon Sep 17 00:00:00 2001 From: Travis Thieman Date: Wed, 25 Mar 2026 16:16:15 -0400 Subject: [PATCH 1/2] test: add --help scenario tests for cut, echo, head, printf, sed, sort, tail, wc These 8 commands were missing scenario tests for their --help/-h flags. Each test verifies: exit code 0 (or 2 for printf), usage printed to stdout, no stderr output. Also documents that echo treats --help as literal text. Co-Authored-By: Claude Sonnet 4.6 --- tests/scenarios/cmd/cut/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/echo/help/help_flag.yaml | 11 +++++++++++ tests/scenarios/cmd/head/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/head/help/short_help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/printf/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/sed/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/sed/help/short_help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/sort/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/sort/help/short_help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/tail/help/help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/tail/help/short_help_flag.yaml | 10 ++++++++++ tests/scenarios/cmd/wc/help/help_flag.yaml | 10 ++++++++++ 12 files changed, 121 insertions(+) create mode 100644 tests/scenarios/cmd/cut/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/echo/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/head/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/head/help/short_help_flag.yaml create mode 100644 tests/scenarios/cmd/printf/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/sed/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/sed/help/short_help_flag.yaml create mode 100644 tests/scenarios/cmd/sort/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/sort/help/short_help_flag.yaml create mode 100644 tests/scenarios/cmd/tail/help/help_flag.yaml create mode 100644 tests/scenarios/cmd/tail/help/short_help_flag.yaml create mode 100644 tests/scenarios/cmd/wc/help/help_flag.yaml diff --git a/tests/scenarios/cmd/cut/help/help_flag.yaml b/tests/scenarios/cmd/cut/help/help_flag.yaml new file mode 100644 index 00000000..e304cd40 --- /dev/null +++ b/tests/scenarios/cmd/cut/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: cut --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + cut --help +expect: + stdout_contains: ["Usage: cut"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/echo/help/help_flag.yaml b/tests/scenarios/cmd/echo/help/help_flag.yaml new file mode 100644 index 00000000..64b0afa0 --- /dev/null +++ b/tests/scenarios/cmd/echo/help/help_flag.yaml @@ -0,0 +1,11 @@ +description: echo --help is not recognised as a flag and is printed as literal text. +# skip: echo does not implement --help; bash behaves the same way +skip_assert_against_bash: true +input: + script: |+ + echo --help +expect: + stdout: |+ + --help + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/head/help/help_flag.yaml b/tests/scenarios/cmd/head/help/help_flag.yaml new file mode 100644 index 00000000..d2ccd94e --- /dev/null +++ b/tests/scenarios/cmd/head/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: head --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + head --help +expect: + stdout_contains: ["Usage: head"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/head/help/short_help_flag.yaml b/tests/scenarios/cmd/head/help/short_help_flag.yaml new file mode 100644 index 00000000..d128ac81 --- /dev/null +++ b/tests/scenarios/cmd/head/help/short_help_flag.yaml @@ -0,0 +1,10 @@ +description: head -h prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + head -h +expect: + stdout_contains: ["Usage: head"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/printf/help/help_flag.yaml b/tests/scenarios/cmd/printf/help/help_flag.yaml new file mode 100644 index 00000000..7dd6546f --- /dev/null +++ b/tests/scenarios/cmd/printf/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: printf --help prints usage to stdout and exits 2. +# skip: rshell builtin help output differs from GNU coreutils; also uses exit 2 +skip_assert_against_bash: true +input: + script: |+ + printf --help +expect: + stdout_contains: ["printf"] + stderr: "" + exit_code: 2 diff --git a/tests/scenarios/cmd/sed/help/help_flag.yaml b/tests/scenarios/cmd/sed/help/help_flag.yaml new file mode 100644 index 00000000..fd3fee7e --- /dev/null +++ b/tests/scenarios/cmd/sed/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: sed --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + sed --help +expect: + stdout_contains: ["Usage: sed"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/sed/help/short_help_flag.yaml b/tests/scenarios/cmd/sed/help/short_help_flag.yaml new file mode 100644 index 00000000..962e0e4a --- /dev/null +++ b/tests/scenarios/cmd/sed/help/short_help_flag.yaml @@ -0,0 +1,10 @@ +description: sed -h prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + sed -h +expect: + stdout_contains: ["Usage: sed"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/sort/help/help_flag.yaml b/tests/scenarios/cmd/sort/help/help_flag.yaml new file mode 100644 index 00000000..2ff23c1e --- /dev/null +++ b/tests/scenarios/cmd/sort/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: sort --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + sort --help +expect: + stdout_contains: ["Usage: sort"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/sort/help/short_help_flag.yaml b/tests/scenarios/cmd/sort/help/short_help_flag.yaml new file mode 100644 index 00000000..e92cc022 --- /dev/null +++ b/tests/scenarios/cmd/sort/help/short_help_flag.yaml @@ -0,0 +1,10 @@ +description: sort -h prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + sort -h +expect: + stdout_contains: ["Usage: sort"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/tail/help/help_flag.yaml b/tests/scenarios/cmd/tail/help/help_flag.yaml new file mode 100644 index 00000000..8d4151c1 --- /dev/null +++ b/tests/scenarios/cmd/tail/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: tail --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + tail --help +expect: + stdout_contains: ["Usage: tail"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/tail/help/short_help_flag.yaml b/tests/scenarios/cmd/tail/help/short_help_flag.yaml new file mode 100644 index 00000000..92360858 --- /dev/null +++ b/tests/scenarios/cmd/tail/help/short_help_flag.yaml @@ -0,0 +1,10 @@ +description: tail -h prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + tail -h +expect: + stdout_contains: ["Usage: tail"] + stderr: "" + exit_code: 0 diff --git a/tests/scenarios/cmd/wc/help/help_flag.yaml b/tests/scenarios/cmd/wc/help/help_flag.yaml new file mode 100644 index 00000000..2ac0cfb0 --- /dev/null +++ b/tests/scenarios/cmd/wc/help/help_flag.yaml @@ -0,0 +1,10 @@ +description: wc --help prints usage to stdout and exits 0. +# skip: rshell builtin help output differs from GNU coreutils +skip_assert_against_bash: true +input: + script: |+ + wc --help +expect: + stdout_contains: ["Usage: wc"] + stderr: "" + exit_code: 0 From 33a6bb92d524097d178c4e9d24d62a7133054650 Mon Sep 17 00:00:00 2001 From: Travis Thieman Date: Wed, 25 Mar 2026 16:35:32 -0400 Subject: [PATCH 2/2] [iter 1] Address review comments: echo skip flag and printf assertion - tests/scenarios/cmd/echo/help/help_flag.yaml: Remove skip_assert_against_bash: true since bash echo --help behaves identically to rshell (prints "--help", exits 0). The test now validates against bash as it should. - tests/scenarios/cmd/printf/help/help_flag.yaml: Strengthen stdout_contains from ["printf"] to ["printf: usage: printf"] to match the actual help string and avoid loose matching. Co-Authored-By: Claude Sonnet 4.6 --- tests/scenarios/cmd/echo/help/help_flag.yaml | 2 -- tests/scenarios/cmd/printf/help/help_flag.yaml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/scenarios/cmd/echo/help/help_flag.yaml b/tests/scenarios/cmd/echo/help/help_flag.yaml index 64b0afa0..0b776925 100644 --- a/tests/scenarios/cmd/echo/help/help_flag.yaml +++ b/tests/scenarios/cmd/echo/help/help_flag.yaml @@ -1,6 +1,4 @@ description: echo --help is not recognised as a flag and is printed as literal text. -# skip: echo does not implement --help; bash behaves the same way -skip_assert_against_bash: true input: script: |+ echo --help diff --git a/tests/scenarios/cmd/printf/help/help_flag.yaml b/tests/scenarios/cmd/printf/help/help_flag.yaml index 7dd6546f..5857e3c5 100644 --- a/tests/scenarios/cmd/printf/help/help_flag.yaml +++ b/tests/scenarios/cmd/printf/help/help_flag.yaml @@ -5,6 +5,6 @@ input: script: |+ printf --help expect: - stdout_contains: ["printf"] + stdout_contains: ["printf: usage: printf"] stderr: "" exit_code: 2