INNER CODE UNIT · Go

TestAgentsEdit_MissingEditor

jrswab/axe · cmd/agents_test.go:494

func TestAgentsEdit_MissingEditor(t *testing.T) {
	agentsDir := setupTestAgentsDir(t)
	writeTestAgent(t, agentsDir, "test", "name = \"test\"\nmodel = \"openai/gpt-4o\"")
	t.Setenv("EDITOR", "")

	buf := new(bytes.Buffer)
	errBuf := new(bytes.Buffer)
	rootCmd.SetOut(buf)
	rootCmd.SetErr(errBuf)
	rootCmd.SetArgs([]string{"agents", "edit", "test"})

	err := rootCmd.Execute()
	if err == nil {
		t.Fatal("expected error for missing EDITOR, got nil")
	}
	if !strings.Contains(err.Error(), "$EDITOR environment variable is not set") {
		t.Errorf("error = %q, want to contain '$EDITOR environment variable is not set'", err.Error())
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…