(t *testing.T)
| 229 | } |
| 230 | |
| 231 | func TestNextID_PlainFormat(t *testing.T) { |
| 232 | resetNextIDFlags() |
| 233 | nextIDFormat = "plain" |
| 234 | |
| 235 | tmpDir := createNextIDTestFiles(t, map[string]string{ |
| 236 | "010-task.md": `--- |
| 237 | id: "010" |
| 238 | title: "Task ten" |
| 239 | status: pending |
| 240 | priority: medium |
| 241 | created: 2026-02-14 |
| 242 | --- |
| 243 | `, |
| 244 | }) |
| 245 | |
| 246 | oldStdout := os.Stdout |
| 247 | r, w, _ := os.Pipe() |
| 248 | os.Stdout = w |
| 249 | |
| 250 | err := runNextID(nextIDCmd, []string{tmpDir}) |
| 251 | |
| 252 | w.Close() |
| 253 | os.Stdout = oldStdout |
| 254 | |
| 255 | if err != nil { |
| 256 | t.Fatalf("unexpected error: %v", err) |
| 257 | } |
| 258 | |
| 259 | var buf bytes.Buffer |
| 260 | buf.ReadFrom(r) |
| 261 | output := strings.TrimSpace(buf.String()) |
| 262 | |
| 263 | if output != "011" { |
| 264 | t.Errorf("expected 011, got %q", output) |
| 265 | } |
| 266 | } |
nothing calls this directly
no test coverage detected