diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-23 23:24:42 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-23 23:24:42 +0300 |
| commit | 713e81daef9b01f24c4120c5e3e34d242f226797 (patch) | |
| tree | cf760da16df9655900a828de7b8b5afba0e9d10f /internal/repl/repl_test.go | |
| parent | d56e16dc85ff3efe7b5865bd27e4804423a6e463 (diff) | |
chore: bump go.mod from go 1.25.0 to go 1.26.0
Update the Go version directive to match the local runtime (go1.26.3).
Also includes go mod tidy cleanup and unrelated test improvements.
Diffstat (limited to 'internal/repl/repl_test.go')
| -rw-r--r-- | internal/repl/repl_test.go | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/internal/repl/repl_test.go b/internal/repl/repl_test.go index 8112227..89fb89a 100644 --- a/internal/repl/repl_test.go +++ b/internal/repl/repl_test.go @@ -713,3 +713,64 @@ func TestDefaultExecutorCodePaths(t *testing.T) { // Path 5: Whitespace only (trimmed to empty, returns early) defaultExecutor(repl, " ") } + +func TestDefaultCompleter(t *testing.T) { + repl := createTestREPL() + got := defaultCompleter(repl) + expected := Commands() + if len(got) != len(expected) { + t.Fatalf("defaultCompleter() returned %d items, want %d", len(got), len(expected)) + } + for i, cmd := range expected { + if got[i] != cmd { + t.Errorf("defaultCompleter()[%d] = %q, want %q", i, got[i], cmd) + } + } +} + +func TestDefaultGetCommandDescription(t *testing.T) { + repl := createTestREPL() + desc := repl.defaultGetCommandDescription("help") + if desc != "Show help information" { + t.Errorf("defaultGetCommandDescription(\"help\") = %q, want %q", desc, "Show help information") + } +} + +func TestNewREPLNilArgs(t *testing.T) { + // NewREPL with nil args should create a valid REPL struct + repl := NewREPL(nil, nil, nil) + if repl == nil { + t.Fatal("NewREPL(nil, nil, nil) returned nil") + } + if repl.ttyChecker == nil { + t.Error("REPL.ttyChecker should not be nil") + } + if repl.historyMgr == nil { + t.Error("REPL.historyMgr should not be nil") + } + if repl.signalHandler == nil { + t.Error("REPL.signalHandler should not be nil") + } + if repl.rpnState == nil { + t.Error("REPL.rpnState should not be nil") + } +} + +func TestREPLDefaultGetCommandDescription(t *testing.T) { + repl := createTestREPL() + tests := []struct { + cmd string + want string + }{ + {"help", "Show help information"}, + {"unknown", ""}, + } + + for _, tt := range tests { + t.Run(tt.cmd, func(t *testing.T) { + if got := repl.defaultGetCommandDescription(tt.cmd); got != tt.want { + t.Errorf("defaultGetCommandDescription(%q) = %q, want %q", tt.cmd, got, tt.want) + } + }) + } +} |
