1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

refactor(global): Move from tempdir to tempfile:

* the crate has been deprecated
This commit is contained in:
Sylvestre Ledru 2020-06-09 11:30:19 +02:00
parent 80987250d2
commit ac34d136f2
7 changed files with 26 additions and 49 deletions

View file

@ -1,4 +1,4 @@
extern crate tempdir;
extern crate tempfile;
#[cfg(unix)]
extern crate unix_socket;

View file

@ -1,6 +1,7 @@
use crate::common::util::*;
extern crate tempdir;
use self::tempdir::TempDir;
extern crate tempfile;
use self::tempfile::tempdir;
static TEST_TEMPLATE1: &'static str = "tempXXXXXX";
static TEST_TEMPLATE2: &'static str = "temp";
@ -266,9 +267,9 @@ fn test_mktemp_suffix() {
#[test]
fn test_mktemp_tmpdir() {
let scene = TestScenario::new(util_name!());
let path = TempDir::new_in(scene.fixtures.as_string(), util_name!()).unwrap();
let pathname = path.path().as_os_str();
let dir = tempdir().unwrap();
let path = dir.path().join(scene.fixtures.as_string());
let pathname = path.as_os_str();
scene
.ucmd()

View file

@ -1,7 +1,7 @@
#![allow(dead_code)]
extern crate tempdir;
extern crate tempfile;
use self::tempdir::TempDir;
use self::tempfile::TempDir;
use std::env;
use std::ffi::OsStr;
use std::fs::{self, File, OpenOptions};
@ -406,7 +406,7 @@ pub struct TestScenario {
impl TestScenario {
pub fn new(util_name: &str) -> TestScenario {
let tmpd = Rc::new(TempDir::new("uutils").unwrap());
let tmpd = Rc::new(TempDir::new().unwrap());
let ts = TestScenario {
bin_path: {
// Instead of hardcoding the path relative to the current