MCPcopy Create free account
hub / github.com/driangle/taskmd / TestNextID_PlainFormat

Function TestNextID_PlainFormat

apps/cli/internal/cli/nextid_test.go:231–266  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func TestNextID_PlainFormat(t *testing.T) {
232 resetNextIDFlags()
233 nextIDFormat = "plain"
234
235 tmpDir := createNextIDTestFiles(t, map[string]string{
236 "010-task.md": `---
237id: "010"
238title: "Task ten"
239status: pending
240priority: medium
241created: 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}

Callers

nothing calls this directly

Calls 3

resetNextIDFlagsFunction · 0.85
createNextIDTestFilesFunction · 0.85
runNextIDFunction · 0.85

Tested by

no test coverage detected