MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_full_workflow

Function test_full_workflow

atomic-core/src/output/filesystem/tests.rs:711–753  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

709
710#[test]
711fn test_full_workflow() {
712 let (_dir, fs) = temp_fs();
713
714 // Create directory structure
715 fs.create_dir_all("src/utils").unwrap();
716
717 // Write files
718 {
719 let mut w = fs.write_file("src/main.rs", Inode::new(1)).unwrap();
720 w.write_all(b"fn main() {}").unwrap();
721 }
722 {
723 let mut w = fs
724 .write_file("src/utils/helpers.rs", Inode::new(2))
725 .unwrap();
726 w.write_all(b"pub fn help() {}").unwrap();
727 }
728
729 // Verify structure
730 assert!(fs.is_directory("src"));
731 assert!(fs.is_directory("src/utils"));
732 assert!(fs.exists("src/main.rs"));
733 assert!(fs.exists("src/utils/helpers.rs"));
734
735 // Read back
736 let mut main_content = Vec::new();
737 fs.read_file("src/main.rs", &mut main_content).unwrap();
738 assert_eq!(main_content, b"fn main() {}");
739
740 // Rename
741 fs.rename("src/utils/helpers.rs", "src/utils/lib.rs")
742 .unwrap();
743 assert!(!fs.exists("src/utils/helpers.rs"));
744 assert!(fs.exists("src/utils/lib.rs"));
745
746 // Remove
747 fs.remove_path("src/utils/lib.rs", false).unwrap();
748 assert!(!fs.exists("src/utils/lib.rs"));
749
750 // Clean up
751 fs.remove_path("src", true).unwrap();
752 assert!(!fs.exists("src"));
753}

Callers

nothing calls this directly

Calls 7

temp_fsFunction · 0.85
unwrapMethod · 0.45
create_dir_allMethod · 0.45
write_fileMethod · 0.45
read_fileMethod · 0.45
renameMethod · 0.45
remove_pathMethod · 0.45

Tested by

no test coverage detected