| 388 | use tempfile::TempDir; |
| 389 | |
| 390 | fn setup_test_workspace() -> TempDir { |
| 391 | let dir = TempDir::new().unwrap(); |
| 392 | let root = dir.path(); |
| 393 | |
| 394 | // Create test files |
| 395 | let mut f1 = File::create(root.join("main.rs")).unwrap(); |
| 396 | writeln!(f1, "fn main() {{\n println!(\"Hello, world!\");\n}}").unwrap(); |
| 397 | |
| 398 | let mut f2 = File::create(root.join("lib.rs")).unwrap(); |
| 399 | writeln!( |
| 400 | f2, |
| 401 | "pub mod auth;\npub mod database;\n\npub fn init() -> Result<()> {{\n Ok(())\n}}" |
| 402 | ) |
| 403 | .unwrap(); |
| 404 | |
| 405 | let mut f3 = File::create(root.join("README.md")).unwrap(); |
| 406 | writeln!( |
| 407 | f3, |
| 408 | "# My Project\n\nA Rust project for testing ripgrep context." |
| 409 | ) |
| 410 | .unwrap(); |
| 411 | |
| 412 | std::fs::create_dir(root.join("src")).unwrap(); |
| 413 | let mut f4 = File::create(root.join("src/auth.rs")).unwrap(); |
| 414 | writeln!( |
| 415 | f4, |
| 416 | "use jwt::Token;\n\npub fn verify_token(token: &str) -> Result<Claims> {{\n // JWT verification logic\n todo!()\n}}" |
| 417 | ) |
| 418 | .unwrap(); |
| 419 | |
| 420 | dir |
| 421 | } |
| 422 | |
| 423 | #[test] |
| 424 | fn test_config_defaults() { |