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

Function TestNextID_EmptyDirectory

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

Source from the content-addressed store, hash-verified

80}
81
82func TestNextID_EmptyDirectory(t *testing.T) {
83 resetNextIDFlags()
84
85 tmpDir := t.TempDir()
86
87 oldStdout := os.Stdout
88 r, w, _ := os.Pipe()
89 os.Stdout = w
90
91 err := runNextID(nextIDCmd, []string{tmpDir})
92
93 w.Close()
94 os.Stdout = oldStdout
95
96 if err != nil {
97 t.Fatalf("unexpected error: %v", err)
98 }
99
100 var buf bytes.Buffer
101 buf.ReadFrom(r)
102 output := strings.TrimSpace(buf.String())
103
104 if output != "001" {
105 t.Errorf("expected 001, got %q", output)
106 }
107}
108
109func TestNextID_PrefixedIDs(t *testing.T) {
110 resetNextIDFlags()

Callers

nothing calls this directly

Calls 2

resetNextIDFlagsFunction · 0.85
runNextIDFunction · 0.85

Tested by

no test coverage detected