(t *testing.T)
| 249 | } |
| 250 | |
| 251 | func TestSet_OwnerUpdateExisting(t *testing.T) { |
| 252 | tmpDir := t.TempDir() |
| 253 | |
| 254 | content := `--- |
| 255 | id: "020" |
| 256 | title: "Task with owner" |
| 257 | status: pending |
| 258 | owner: alice |
| 259 | created: 2026-02-08 |
| 260 | --- |
| 261 | |
| 262 | # Task with owner |
| 263 | ` |
| 264 | path := filepath.Join(tmpDir, "020-owned.md") |
| 265 | if err := os.WriteFile(path, []byte(content), 0644); err != nil { |
| 266 | t.Fatalf("Failed to create test file: %v", err) |
| 267 | } |
| 268 | |
| 269 | resetSetFlags() |
| 270 | taskDir = tmpDir |
| 271 | setTaskID = "020" |
| 272 | setOwner = "bob" |
| 273 | |
| 274 | output, err := captureSetOutput(t) |
| 275 | if err != nil { |
| 276 | t.Fatalf("unexpected error: %v", err) |
| 277 | } |
| 278 | |
| 279 | if !strings.Contains(output, "owner: alice -> bob") { |
| 280 | t.Errorf("Expected owner change in output, got: %s", output) |
| 281 | } |
| 282 | |
| 283 | updated, _ := os.ReadFile(path) |
| 284 | if !strings.Contains(string(updated), "owner: bob") { |
| 285 | t.Errorf("Expected file to contain owner: bob, got:\n%s", string(updated)) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | func TestSet_DoneFlag(t *testing.T) { |
| 290 | tmpDir := createSetTestFiles(t) |
nothing calls this directly
no test coverage detected