(t *testing.T)
| 144 | } |
| 145 | |
| 146 | func TestGet_IDPrecedenceOverTitle(t *testing.T) { |
| 147 | tmpDir := t.TempDir() |
| 148 | |
| 149 | // Create a task whose title matches another task's ID |
| 150 | task1 := `--- |
| 151 | id: "abc" |
| 152 | title: "First task" |
| 153 | status: pending |
| 154 | priority: low |
| 155 | dependencies: [] |
| 156 | tags: [] |
| 157 | created: 2026-02-08 |
| 158 | --- |
| 159 | |
| 160 | # First task |
| 161 | ` |
| 162 | task2 := `--- |
| 163 | id: "xyz" |
| 164 | title: "abc" |
| 165 | status: pending |
| 166 | priority: high |
| 167 | dependencies: [] |
| 168 | tags: [] |
| 169 | created: 2026-02-08 |
| 170 | --- |
| 171 | |
| 172 | # abc task |
| 173 | ` |
| 174 | os.WriteFile(filepath.Join(tmpDir, "task1.md"), []byte(task1), 0644) |
| 175 | os.WriteFile(filepath.Join(tmpDir, "task2.md"), []byte(task2), 0644) |
| 176 | |
| 177 | resetGetFlags() |
| 178 | taskDir = tmpDir |
| 179 | |
| 180 | output := captureGetOutput(t, "abc") |
| 181 | |
| 182 | // Should match by ID (task1), not by title (task2) |
| 183 | if !strings.Contains(output, "Title: First task") { |
| 184 | t.Error("Expected ID match to take precedence over title match") |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | func TestGet_TaskNotFound_ExactMode(t *testing.T) { |
| 189 | tmpDir := createGetTestFiles(t) |
nothing calls this directly
no test coverage detected