MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / test_insert_at_line

Function test_insert_at_line

crates/agent/src/agent/tools/fs_write.rs:439–455  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 4

InsertClass · 0.85
to_stringMethod · 0.80
joinMethod · 0.80
with_fileMethod · 0.45

Tested by

no test coverage detected