(t *testing.T)
| 241 | } |
| 242 | |
| 243 | func TestGraphCommand_ASCII_Format(t *testing.T) { |
| 244 | tmpDir := createTestTaskFiles(t) |
| 245 | |
| 246 | // Reset flags |
| 247 | graphFormat = "ascii" |
| 248 | graphExcludeStatus = []string{} |
| 249 | graphAll = false |
| 250 | graphRoot = "" |
| 251 | graphFocus = "" |
| 252 | graphUpstream = false |
| 253 | graphDownstream = false |
| 254 | graphOut = "" |
| 255 | |
| 256 | // Capture stdout |
| 257 | oldStdout := os.Stdout |
| 258 | r, w, _ := os.Pipe() |
| 259 | os.Stdout = w |
| 260 | |
| 261 | // Run command |
| 262 | err := runGraph(graphCmd, []string{tmpDir}) |
| 263 | if err != nil { |
| 264 | t.Fatalf("runGraph failed: %v", err) |
| 265 | } |
| 266 | |
| 267 | // Restore stdout |
| 268 | w.Close() |
| 269 | os.Stdout = oldStdout |
| 270 | |
| 271 | // Read output |
| 272 | var buf bytes.Buffer |
| 273 | buf.ReadFrom(r) |
| 274 | output := buf.String() |
| 275 | |
| 276 | // Verify output contains task IDs |
| 277 | if !strings.Contains(output, "[001]") { |
| 278 | t.Error("Expected ASCII output to contain [001]") |
| 279 | } |
| 280 | |
| 281 | if !strings.Contains(output, "[005]") { |
| 282 | t.Error("Expected ASCII output to contain [005]") |
| 283 | } |
| 284 | |
| 285 | // Verify tree structure characters |
| 286 | if !strings.Contains(output, "└──") || !strings.Contains(output, "├──") { |
| 287 | t.Error("Expected ASCII output to contain tree structure characters") |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | func TestGraphCommand_ASCII_ExcludeCompleted(t *testing.T) { |
| 292 | tmpDir := createTestTaskFiles(t) |
nothing calls this directly
no test coverage detected