Skip to content
Myr

Merge pull request #1189 from tmccombs/tempfile

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Use tempfile instead of tempdir

authored by Thayne McCombs · committed by GitHub · parents 2aa966c, 650a511 · Browse files · 3 files+33 added−52 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+33 added−52 removed

  • tests:+5 added−3 removed
  • other:+28 added−49 removed

3 files+33 added−52 removed

modified:tests/testenv/mod.rs+5 added-3 removed
6 unmodified lines
7use std::os::windows;8use std::path::{Path, PathBuf};9use std::process;1011use tempdir::TempDir;11use tempfile::TempDir;1213/// Environment for the integration tests.14pub struct TestEnv {15 /// Temporary working directory.
10 unmodified lines
26fn create_working_directory(27 directories: &[&'static str],28 files: &[&'static str],29) -> Result<TempDir, io::Error> {30 let temp_dir = TempDir::new("fd-tests")?;30 let temp_dir = tempfile::Builder::new().prefix("fd-tests").tempdir()?;3132 {33 let root = temp_dir.path();34
133 unmodified lines
168 ) -> Result<PathBuf, io::Error> {169 let root = self.test_root();170 let broken_symlink_link = root.join(link_path);171 {172 let temp_target_dir = TempDir::new("fd-tests-broken-symlink")?;172 let temp_target_dir = tempfile::Builder::new()173 .prefix("fd-tests-broken-symlink")174 .tempdir()?;175 let broken_symlink_target = temp_target_dir.path().join("broken_symlink_target");176 fs::File::create(&broken_symlink_target)?;177 #[cfg(unix)]178 unix::fs::symlink(&broken_symlink_target, &broken_symlink_link)?;
145 unmodified lines
modified:Cargo.lock+27 added-48 removed
305 unmodified lines
306 "winapi",307]308309[[package]]310name = "fastrand"311version = "1.8.0"312source = "registry+https://github.com/rust-lang/crates.io-index"313checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"314dependencies = [315 "instant",316]317318[[package]]319name = "fd-find"320version = "8.5.3"321dependencies = [322 "ansi_term",
20 unmodified lines
343 "num_cpus",344 "once_cell",345 "regex",346 "regex-syntax",338 "tempdir",347 "tempfile",348 "test-case",349 "users",350 "version_check",351]
22 unmodified lines
374source = "registry+https://github.com/rust-lang/crates.io-index"375checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"376377[[package]]369name = "fuchsia-cprng"370version = "0.1.1"371source = "registry+https://github.com/rust-lang/crates.io-index"372checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"373374[[package]]378name = "getrandom"379version = "0.2.8"380source = "registry+https://github.com/rust-lang/crates.io-index"381checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
79 unmodified lines
461 "winapi-util",462]463464[[package]]465name = "instant"466version = "0.1.12"467source = "registry+https://github.com/rust-lang/crates.io-index"468checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"469dependencies = [470 "cfg-if",471]472473[[package]]474name = "io-lifetimes"475version = "0.7.4"476source = "registry+https://github.com/rust-lang/crates.io-index"477checksum = "e6e481ccbe3dea62107216d0d1138bb8ad8e5e5c43009a098bd1990272c497b0"
194 unmodified lines
672 "proc-macro2",673]674675[[package]]664name = "rand"665version = "0.4.6"666source = "registry+https://github.com/rust-lang/crates.io-index"667checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"668dependencies = [669 "fuchsia-cprng",670 "libc",671 "rand_core 0.3.1",672 "rdrand",673 "winapi",674]675676[[package]]677name = "rand_core"678version = "0.3.1"679source = "registry+https://github.com/rust-lang/crates.io-index"680checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"681dependencies = [682 "rand_core 0.4.2",683]684685[[package]]686name = "rand_core"687version = "0.4.2"688source = "registry+https://github.com/rust-lang/crates.io-index"689checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"690691[[package]]692name = "rdrand"693version = "0.4.0"694source = "registry+https://github.com/rust-lang/crates.io-index"695checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"696dependencies = [697 "rand_core 0.3.1",698]699700[[package]]676name = "redox_syscall"677version = "0.2.16"678source = "registry+https://github.com/rust-lang/crates.io-index"679checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
84 unmodified lines
764 "unicode-ident",765]766767[[package]]793name = "tempdir"794version = "0.3.7"768name = "tempfile"769version = "3.3.0"770source = "registry+https://github.com/rust-lang/crates.io-index"796checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"771checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"772dependencies = [798 "rand",773 "cfg-if",774 "fastrand",775 "libc",776 "redox_syscall",777 "remove_dir_all",778 "winapi",779]780781[[package]]782name = "termcolor"
314 unmodified lines
modified:Cargo.toml+1 added-1 removed