()
| 479 | |
| 480 | #[test] |
| 481 | fn lazy_temp_dir_creation() -> Result<()> { |
| 482 | // A default configuration should not create temp files until requested |
| 483 | let dm = Arc::new(DiskManagerBuilder::default().build()?); |
| 484 | |
| 485 | assert_eq!(0, local_dir_snapshot(&dm).len()); |
| 486 | |
| 487 | // can still create a tempfile however: |
| 488 | let actual = dm.create_tmp_file("Testing")?; |
| 489 | |
| 490 | // Now the tempdir has been created on demand |
| 491 | assert_eq!(1, local_dir_snapshot(&dm).len()); |
| 492 | |
| 493 | // the returned tempfile file should be in the temp directory |
| 494 | let local_dirs = local_dir_snapshot(&dm); |
| 495 | assert_path_in_dirs(actual.path(), local_dirs.iter().map(|p| p.as_path())); |
| 496 | |
| 497 | Ok(()) |
| 498 | } |
| 499 | |
| 500 | fn local_dir_snapshot(dm: &DiskManager) -> Vec<PathBuf> { |
| 501 | dm.local_dirs |
nothing calls this directly
no test coverage detected
searching dependent graphs…