(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func TestExecutor_CreateLogFileWithEnv(t *testing.T) { |
| 96 | tmpDir := t.TempDir() |
| 97 | logPath := tmpDir + "/test.log" |
| 98 | |
| 99 | executor := NewExecutor("test", "echo").SetLogPath(logPath) |
| 100 | execCmd := exec.Command("echo") |
| 101 | execCmd.Env = os.Environ() |
| 102 | |
| 103 | logFile, err := executor.createLogFile(execCmd) |
| 104 | if err != nil { |
| 105 | t.Fatalf("unexpected error: %v", err) |
| 106 | } |
| 107 | logFile.Close() |
| 108 | |
| 109 | data, err := os.ReadFile(logPath) |
| 110 | if err != nil { |
| 111 | t.Fatalf("failed to read log file: %v", err) |
| 112 | } |
| 113 | content := string(data) |
| 114 | if !strings.Contains(content, "Environment:") { |
| 115 | t.Error("log file should contain 'Environment:' header") |
| 116 | } |
| 117 | if !strings.Contains(content, "test:") { |
| 118 | t.Error("log file should contain title header") |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | func TestExecutor_ConfigureOutputs_NilOutput(t *testing.T) { |
| 123 | executor := NewExecutor("test", "echo") |
nothing calls this directly
no test coverage detected