From 3303825900124083d1551335b1cf2085cb35955d Mon Sep 17 00:00:00 2001 From: Alexandre Yang Date: Thu, 7 May 2026 23:39:29 +0200 Subject: [PATCH] fix(help): list while/until as supported The control-flow feature description and unsupported-summary advertised while and until loops as unsupported, but the interpreter has supported both for some time (and SHELL_FEATURES.md already documents them as supported). Move them from Unsupported to Supported and update the pinned strings in help_test.go and the unrestricted help scenario. --- builtins/features.go | 7 ++++--- builtins/tests/help/help_test.go | 2 +- tests/scenarios/cmd/help/unrestricted.yaml | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/builtins/features.go b/builtins/features.go index 19e73fa64..031e356da 100644 --- a/builtins/features.go +++ b/builtins/features.go @@ -51,16 +51,17 @@ var featureRegistry = []FeatureMeta{ }, { Name: "control-flow", - Description: "for/if/&&/||/!/groups/subshells; no while/case/select/functions.", + Description: "for/while/until/if/&&/||/!/groups/subshells; no case/select/functions.", Supported: []string{ "for VAR in WORDS; do CMDS; done.", + "while CONDITION; do CMDS; done — runs CMDS while the condition's last command exits 0.", + "until CONDITION; do CMDS; done — runs CMDS while the condition's last command exits non-zero.", "if / elif / else conditionals.", "AND/OR lists with && and ||, plus ! exit-code negation.", "Brace groups with { CMDS; } and command separators with ; or newline.", "Subshells with ( CMDS ); variable changes and exit are isolated from the parent shell.", }, Unsupported: []string{ - "while and until loops.", "case and select statements.", "C-style for loops: for (( ... )).", "Shell functions: name() { ... }.", @@ -140,7 +141,7 @@ var featureRegistry = []FeatureMeta{ var unsupportedSummary = []string{ "Expansions: arithmetic $((...)), arrays, advanced ${...} operations, tilde expansion, process substitution, extended globbing.", - "Control flow: while/until, case, select, C-style for ((...)), and shell functions.", + "Control flow: case, select, C-style for ((...)), and shell functions.", "Execution: external commands by default, background jobs, coprocesses, time, [[...]], ((...)), declare/export/local/readonly/let.", "I/O and environment: arbitrary output file redirects, |&, herestrings, read-write redirects, input fd duplication, host env inheritance.", } diff --git a/builtins/tests/help/help_test.go b/builtins/tests/help/help_test.go index becfa9d08..4261a9099 100644 --- a/builtins/tests/help/help_test.go +++ b/builtins/tests/help/help_test.go @@ -210,7 +210,7 @@ func TestHelpListsFeaturesAndUnsupportedSummary(t *testing.T) { assert.Contains(t, stdout, "pipes-redirections") assert.Contains(t, stdout, "Not supported:") assert.Contains(t, stdout, "arithmetic $((...))") - assert.Contains(t, stdout, "while/until") + assert.Contains(t, stdout, "case, select") assert.Contains(t, stdout, "arbitrary output file redirects") } diff --git a/tests/scenarios/cmd/help/unrestricted.yaml b/tests/scenarios/cmd/help/unrestricted.yaml index 44d9bf145..adda91b94 100644 --- a/tests/scenarios/cmd/help/unrestricted.yaml +++ b/tests/scenarios/cmd/help/unrestricted.yaml @@ -9,10 +9,10 @@ expect: - "commands available" - "Features:" - "commands Registered commands run inside the interpreter" - - "control-flow for/if/&&/||/!/groups/subshells" + - "control-flow for/while/until/if/&&/||/!/groups/subshells" - "Not supported:" - "arithmetic $((...))" - - "while/until" + - "case, select" - "Commands:" - "echo" - "write arguments to stdout"