(t *testing.T)
| 263 | } |
| 264 | |
| 265 | func TestAdd_SpecialCharactersInTitle(t *testing.T) { |
| 266 | tmpDir := t.TempDir() |
| 267 | resetAddFlags() |
| 268 | taskDir = tmpDir |
| 269 | |
| 270 | _, err := captureAddOutput(t, "Fix bug: login/auth (urgent!)") |
| 271 | if err != nil { |
| 272 | t.Fatalf("unexpected error: %v", err) |
| 273 | } |
| 274 | |
| 275 | files, _ := filepath.Glob(filepath.Join(tmpDir, "001-*.md")) |
| 276 | if len(files) != 1 { |
| 277 | t.Fatalf("expected 1 file, got %d", len(files)) |
| 278 | } |
| 279 | |
| 280 | filename := filepath.Base(files[0]) |
| 281 | // Slug should only contain lowercase alphanumeric and hyphens |
| 282 | if strings.ContainsAny(filename, ":/(!)") { |
| 283 | t.Errorf("filename should not contain special chars, got: %s", filename) |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | func TestAdd_EmptyDirectory(t *testing.T) { |
| 288 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected