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

Method roundtrip

atomic-cli/tests/it/record_rename_attributes_test.rs:143–162  ·  view source on GitHub ↗
(&self, expected: &[u8])

Source from the content-addressed store, hash-verified

141 }
142
143 fn roundtrip(&self, expected: &[u8]) {
144 let repo = Repository::open(self.root.path()).unwrap();
145 let current = repo.current_view().to_string();
146 drop(repo);
147 self.atomic(&["view", "switch", "before-rename"]);
148 assert_eq!(fs::read(self.root.path().join("old.txt")).unwrap(), BASE);
149 assert!(!self.root.path().join("new.txt").exists());
150 self.atomic(&["view", "switch", &current]);
151 // Reconstruct from recorded data, rather than accepting retained bytes.
152 fs::remove_file(self.root.path().join("new.txt")).unwrap();
153 let repo = Repository::open(self.root.path()).unwrap();
154 repo.materialize(repo.require_working_copy_id().unwrap())
155 .unwrap();
156 assert_eq!(
157 fs::read(self.root.path().join("new.txt")).unwrap(),
158 expected
159 );
160 assert!(!self.root.path().join("old.txt").exists());
161 self.assert_identity(&repo);
162 }
163}
164
165#[test]

Calls 8

openFunction · 0.85
assert_identityMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45
current_viewMethod · 0.45
atomicMethod · 0.45
materializeMethod · 0.45

Tested by

no test coverage detected