From 713e81daef9b01f24c4120c5e3e34d242f226797 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 23 May 2026 23:24:42 +0300 Subject: 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. --- internal/repl/repl_test.go | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'internal/repl/repl_test.go') 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) + } + }) + } +} -- cgit v1.2.3