MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / assert_equal_dirs

Function assert_equal_dirs

crates/commitlog/tests/streaming/mod.rs:161–181  ·  view source on GitHub ↗
(src: &Path, dst: &Path)

Source from the content-addressed store, hash-verified

159}
160
161async fn assert_equal_dirs(src: &Path, dst: &Path) {
162 let mut src_dir = fs::read_dir(src).await.map(ReadDirStream::new).unwrap();
163 let mut buf_a = vec![];
164 let mut buf_b = vec![];
165 while let Some(entry) = src_dir.next().await.map(Result::unwrap) {
166 if entry.file_type().await.unwrap().is_file() {
167 let src_path = entry.path();
168 let dst_path = dst.join(src_path.file_name().unwrap());
169
170 let mut src_file = fs::File::open(&src_path).await.unwrap();
171 let mut dst_file = fs::File::open(&dst_path).await.unwrap();
172
173 src_file.read_to_end(&mut buf_a).await.unwrap();
174 dst_file.read_to_end(&mut buf_b).await.unwrap();
175
176 assert_eq!(buf_a, buf_b, "{} and {} differ", src_path.display(), dst_path.display());
177 }
178 buf_a.clear();
179 buf_b.clear();
180 }
181}
182
183fn default_options() -> Options {
184 Options {

Callers 3

copy_allFunction · 0.85
copy_rangesFunction · 0.85
trim_garbageFunction · 0.85

Calls 7

joinMethod · 0.80
clearMethod · 0.65
openFunction · 0.50
unwrapMethod · 0.45
mapMethod · 0.45
nextMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…