diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-25 09:05:44 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-25 09:05:44 +0300 |
| commit | 035460d315c71ac78f6741fca6f87ac65c54fb42 (patch) | |
| tree | e28564fcee107dbc0f120501831c345303a9d440 /internal/repl/help_test.go | |
| parent | 7b3ff83f749724d452215fe135765b7e6aba92f5 (diff) | |
fix: exclude 'help' from help topic completions
'help <TAB>' was suggesting 'help help'. Skip 'help' itself
in GetCompletionTopics so tab completion offers actual topics.
Diffstat (limited to 'internal/repl/help_test.go')
| -rw-r--r-- | internal/repl/help_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/repl/help_test.go b/internal/repl/help_test.go index ca77462..9813ebb 100644 --- a/internal/repl/help_test.go +++ b/internal/repl/help_test.go @@ -134,8 +134,8 @@ func TestGetCompletionTopicsIncludesAliases(t *testing.T) { expectedAliases := []string{"exit", "calc", "gt", "lt", "categories"} for _, expected := range expectedAliases { found := false - for _, t := range topics { - if t == expected { + for _, topic := range topics { + if topic == expected { found = true break } @@ -144,6 +144,13 @@ func TestGetCompletionTopicsIncludesAliases(t *testing.T) { t.Errorf("GetCompletionTopics() missing alias/topic %q", expected) } } + + // "help" itself should NOT be in completion topics + for _, topic := range topics { + if topic == "help" { + t.Error("GetCompletionTopics() should not include 'help' itself") + } + } } func TestGetCompletionTopicsIsSorted(t *testing.T) { |
