MCPcopy Index your code
hub / github.com/Firstyear/opensuse-proxy-cache / disk_cache_test_basic

Function disk_cache_test_basic

arc-disk-cache/src/lib.rs:805–821  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

803
804 #[test]
805 fn disk_cache_test_basic() {
806 let _ = tracing_subscriber::fmt::try_init();
807
808 let dir = tempdir().expect("Failed to build tempdir");
809 // let dir = std::path::PathBuf::from("/tmp/dc");
810
811 // Need a new temp dir
812 let dc: ArcDiskCache<String, ()> = ArcDiskCache::new(1024, &dir, false).unwrap();
813
814 let mut fh = dc.new_tempfile().unwrap();
815 let k = String::from("TestFile!");
816
817 let file = fh.as_file_mut();
818 file.write_all(b"Hello From Cache").unwrap();
819
820 dc.insert(k, (), fh);
821 }
822}

Callers

nothing calls this directly

Calls 2

new_tempfileMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected