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

Function test_full_workflow

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

Source from the content-addressed store, hash-verified

731
732#[test]
733fn test_full_workflow() {
734 let (_dir, fs) = temp_fs();
735
736 // Create directory structure
737 fs.create_dir_all("src/utils").unwrap();
738
739 // Write files
740 {
741 let mut w = fs.write_file("src/main.rs", Inode::new(1)).unwrap();
742 w.write_all(b"fn main() {}").unwrap();
743 }
744 {
745 let mut w = fs
746 .write_file("src/utils/helpers.rs", Inode::new(2))
747 .unwrap();
748 w.write_all(b"pub fn help() {}").unwrap();
749 }
750
751 // Verify structure
752 assert!(fs.is_directory("src"));
753 assert!(fs.is_directory("src/utils"));
754 assert!(fs.exists("src/main.rs"));
755 assert!(fs.exists("src/utils/helpers.rs"));
756
757 // Read back
758 let mut main_content = Vec::new();
759 fs.read_file("src/main.rs", &mut main_content).unwrap();
760 assert_eq!(main_content, b"fn main() {}");
761
762 // Rename
763 fs.rename("src/utils/helpers.rs", "src/utils/lib.rs")
764 .unwrap();
765 assert!(!fs.exists("src/utils/helpers.rs"));
766 assert!(fs.exists("src/utils/lib.rs"));
767
768 // Remove
769 fs.remove_path("src/utils/lib.rs", false).unwrap();
770 assert!(!fs.exists("src/utils/lib.rs"));
771
772 // Clean up
773 fs.remove_path("src", true).unwrap();
774 assert!(!fs.exists("src"));
775}

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