| 437 | |
| 438 | #[tokio::test] |
| 439 | async fn test_insert_at_line() { |
| 440 | let test_base = TestBase::new() |
| 441 | .await |
| 442 | .with_file(("test.txt", "line1\nline2\nline3")) |
| 443 | .await; |
| 444 | |
| 445 | let tool = FsWrite::Insert(Insert { |
| 446 | path: test_base.join("test.txt").to_string_lossy().to_string(), |
| 447 | content: "inserted".to_string(), |
| 448 | insert_line: Some(1), |
| 449 | }); |
| 450 | |
| 451 | assert!(tool.execute(None, &test_base).await.is_ok()); |
| 452 | |
| 453 | let content = tokio::fs::read_to_string(test_base.join("test.txt")).await.unwrap(); |
| 454 | assert_eq!(content, "line1\ninserted\nline2\nline3"); |
| 455 | } |
| 456 | |
| 457 | #[tokio::test] |
| 458 | async fn test_insert_append() { |