Files
task-master/internal/ticket/editfile_editor_test.go
SkrueckenandCursor 24c1e146ec Add offline-first task-master TUI with tickets, board lists, and undo.
Charm-based CLI with JSON persistence, status/list filters, external editor editing, command-history undo/redo, and glamour markdown without AutoStyle OSC hangs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 10:21:48 +02:00

35 lines
714 B
Go

package ticket_test
import (
"os"
"os/exec"
"testing"
"task/internal/ticket"
)
func TestResolveEditorPrefersEnv(t *testing.T) {
t.Setenv("EDITOR", "custom-ed")
t.Setenv("VISUAL", "visual-ed")
if got := ticket.ResolveEditor(); got != "custom-ed" {
t.Fatalf("got %q, want custom-ed", got)
}
}
func TestResolveEditorFallsBackToNvim(t *testing.T) {
t.Setenv("EDITOR", "")
t.Setenv("VISUAL", "")
got := ticket.ResolveEditor()
if _, err := exec.LookPath("nvim"); err == nil {
if got != "nvim" {
t.Fatalf("got %q, want nvim when available", got)
}
return
}
// Without nvim, accept vim/vi.
if got != "vim" && got != "vi" {
t.Fatalf("got unexpected fallback %q", got)
}
_ = os.Environ()
}