Replace tempdir with tempfile
This commit is contained in:
parent
92ac0d0384
commit
52e00de3bb
3 changed files with 6 additions and 6 deletions
|
|
@ -14,4 +14,4 @@ tokio = { version = "1.6.1", features = ["rt", "process", "io-util", "macros", "
|
|||
once_cell = "1.4"
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3"
|
||||
tempfile = "3"
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ use schematics::symbols::Symbol;
|
|||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tempdir::TempDir;
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
fn get_dir(content: Option<&str>) -> TempDir {
|
||||
let tmp_dir = TempDir::new("unittest").expect("create temp dir");
|
||||
let tmp_dir = tempdir().expect("create temp dir");
|
||||
if content.is_none() {
|
||||
return tmp_dir;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ use regex::Regex;
|
|||
use schematics::storage::{SimpleStorage, Storage};
|
||||
use std::fs::{create_dir, File};
|
||||
use std::path::Path;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::{tempdir, TempDir};
|
||||
|
||||
fn get_dir<'a, I: IntoIterator<Item = &'a &'a str>>(content: I) -> TempDir {
|
||||
let tmp_dir = TempDir::new("unittest").expect("create temp dir");
|
||||
let tmp_dir = tempdir().expect("create temp dir");
|
||||
let storage_path = tmp_dir.path().join("_filename");
|
||||
create_dir(storage_path.clone()).unwrap();
|
||||
for path in content {
|
||||
|
|
@ -93,7 +93,7 @@ fn three_files() {
|
|||
|
||||
#[test]
|
||||
fn empty_storage() {
|
||||
let dir = TempDir::new("unittest").expect("create temp dir");
|
||||
let dir = tempdir().expect("create temp dir");
|
||||
let storage = get_storage(dir.path());
|
||||
|
||||
assert!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue