()
| 9 | |
| 10 | #[test] |
| 11 | fn test_cache_init() { |
| 12 | let (_tempdir, cache_dir, config_path) = test_prolog(); |
| 13 | let baseline_compression_level = 4; |
| 14 | let config_content = format!( |
| 15 | "[cache]\n\ |
| 16 | directory = '{}'\n\ |
| 17 | baseline-compression-level = {}\n", |
| 18 | cache_dir.display(), |
| 19 | baseline_compression_level, |
| 20 | ); |
| 21 | fs::write(&config_path, config_content).expect("Failed to write test config file"); |
| 22 | |
| 23 | let cache_config = CacheConfig::from_file(Some(&config_path)).unwrap(); |
| 24 | |
| 25 | // assumption: config init creates cache directory and returns canonicalized path |
| 26 | assert_eq!( |
| 27 | cache_config.directory(), |
| 28 | Some(&fs::canonicalize(cache_dir).unwrap()) |
| 29 | ); |
| 30 | assert_eq!( |
| 31 | cache_config.baseline_compression_level(), |
| 32 | baseline_compression_level |
| 33 | ); |
| 34 | |
| 35 | // test if we can use worker |
| 36 | Cache::new(cache_config) |
| 37 | .unwrap() |
| 38 | .worker() |
| 39 | .on_cache_update_async(config_path); |
| 40 | } |
| 41 | |
| 42 | #[test] |
| 43 | fn test_write_read_cache() { |
nothing calls this directly
no test coverage detected