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

Function test_write_file

atomic-core/src/output/memory.rs:1046–1058  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1044
1045 #[test]
1046 fn test_write_file() {
1047 let wc = Memory::new();
1048 let inode = wc.allocate_inode();
1049
1050 {
1051 let mut writer = wc.write_file("test.txt", inode).unwrap();
1052 writer.write_all(b"hello").unwrap();
1053 writer.write_all(b" world").unwrap();
1054 }
1055
1056 let contents = wc.get_file_contents("test.txt").unwrap();
1057 assert_eq!(contents, b"hello world");
1058 }
1059
1060 #[test]
1061 fn test_write_file_creates_parent_dirs() {

Callers

nothing calls this directly

Calls 4

allocate_inodeMethod · 0.80
get_file_contentsMethod · 0.80
unwrapMethod · 0.45
write_fileMethod · 0.45

Tested by

no test coverage detected