mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 21:52:37 +00:00
chore: Switch from tempdir to tempfile
Former is deprecated. Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
This commit is contained in:
parent
e74b416bca
commit
dfdf8a19b4
7 changed files with 164 additions and 46 deletions
149
Cargo.lock
generated
149
Cargo.lock
generated
|
@ -18,11 +18,21 @@ dependencies = [
|
|||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.6"
|
||||
|
@ -57,17 +67,16 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon-sys"
|
||||
version = "0.3.3"
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -106,7 +115,7 @@ dependencies = [
|
|||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lscolors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -132,14 +141,108 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.4.3"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_isaac"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_jitter"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_os"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_pcg"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rdrand"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.43"
|
||||
|
@ -167,12 +270,16 @@ version = "0.7.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "tempdir"
|
||||
version = "0.3.7"
|
||||
name = "tempfile"
|
||||
version = "3.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -294,24 +401,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
[metadata]
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
|
||||
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
|
||||
"checksum chrono-humanize 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "eb2ff48a655fe8d2dae9a39e66af7fd8ff32a879e8c4e27422c25596a8b5e90d"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)" = "42914d39aad277d9e176efbdad68acb1d5443ab65afe0e0e4f0d49352a950880"
|
||||
"checksum lscolors 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9938fd8c379393454f73ec4c9c5b40f3d8332d80b25a29da05e41ee0ecbb559"
|
||||
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
|
||||
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
||||
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
|
||||
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
|
||||
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
||||
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
|
||||
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
|
||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||
"checksum tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7dc4738f2e68ed2855de5ac9cdbe05c9216773ecde4739b2f095002ab03a13ef"
|
||||
"checksum term_grid 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "230d3e804faaed5a39b08319efb797783df2fd9671b39b7596490cb486d702cf"
|
||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||
"checksum terminal_size 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "023345d35850b69849741bd9a5432aa35290e3d8eb76af8717026f270d1cf133"
|
||||
|
|
|
@ -41,7 +41,7 @@ features = ["suggestions", "color", "wrap_help"]
|
|||
version = "2.32.0"
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3.7"
|
||||
tempfile = "3"
|
||||
|
||||
[features]
|
||||
sudo = []
|
||||
|
|
18
src/icon.rs
18
src/icon.rs
|
@ -311,11 +311,11 @@ mod test {
|
|||
use super::{Icons, Theme, ICON_SPACE};
|
||||
use crate::meta::Meta;
|
||||
use std::fs::File;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn get_no_icon() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path().join("file.txt");
|
||||
File::create(&file_path).expect("failed to create file");
|
||||
let meta = Meta::from_path(&file_path).unwrap();
|
||||
|
@ -328,7 +328,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_default_file_icon() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path().join("file");
|
||||
File::create(&file_path).expect("failed to create file");
|
||||
let meta = Meta::from_path(&file_path).unwrap();
|
||||
|
@ -341,7 +341,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_default_file_icon_unicode() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path().join("file");
|
||||
File::create(&file_path).expect("failed to create file");
|
||||
let meta = Meta::from_path(&file_path).unwrap();
|
||||
|
@ -354,7 +354,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_directory_icon() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path();
|
||||
let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
|
||||
|
||||
|
@ -366,7 +366,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_directory_icon_unicode() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path();
|
||||
let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
|
||||
|
||||
|
@ -378,7 +378,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_directory_icon_with_ext() {
|
||||
let tmp_dir = TempDir::new("test_file_type.rs").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let file_path = tmp_dir.path();
|
||||
let meta = Meta::from_path(&file_path.to_path_buf()).unwrap();
|
||||
|
||||
|
@ -390,7 +390,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_icon_by_name() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
for (file_name, file_icon) in &Icons::get_default_icons_by_name() {
|
||||
let file_path = tmp_dir.path().join(file_name);
|
||||
|
@ -406,7 +406,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn get_icon_by_extension() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
for (ext, file_icon) in &Icons::get_default_icons_by_extension() {
|
||||
let file_path = tmp_dir.path().join(format!("file.{}", ext));
|
||||
|
|
|
@ -12,7 +12,7 @@ extern crate chrono_humanize;
|
|||
extern crate libc;
|
||||
extern crate lscolors;
|
||||
#[cfg(test)]
|
||||
extern crate tempdir;
|
||||
extern crate tempfile;
|
||||
extern crate term_grid;
|
||||
extern crate terminal_size;
|
||||
extern crate time;
|
||||
|
|
|
@ -102,12 +102,12 @@ mod test {
|
|||
use std::os::unix::net::UnixListener;
|
||||
#[cfg(unix)]
|
||||
use std::process::Command;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)] // Windows uses different default permissions
|
||||
fn test_file_type() {
|
||||
let tmp_dir = TempDir::new("test_file_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let file_path = tmp_dir.path().join("file.txt");
|
||||
|
@ -122,7 +122,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_dir_type() {
|
||||
let tmp_dir = TempDir::new("test_dir_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let meta =
|
||||
Meta::from_path(&tmp_dir.path().to_path_buf()).expect("failed to get tempdir path");
|
||||
let metadata = tmp_dir.path().metadata().expect("failed to get metas");
|
||||
|
@ -136,7 +136,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(unix)] // Symlink support is *hard* on Windows
|
||||
fn test_symlink_type() {
|
||||
let tmp_dir = TempDir::new("test_symlink_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let file_path = tmp_dir.path().join("file.tmp");
|
||||
|
@ -158,7 +158,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(unix)] // Windows pipes aren't like Unix pipes
|
||||
fn test_pipe_type() {
|
||||
let tmp_dir = TempDir::new("test_pipe_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the pipe;
|
||||
let pipe_path = tmp_dir.path().join("pipe.tmp");
|
||||
|
@ -179,7 +179,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(feature = "sudo")]
|
||||
fn test_char_device_type() {
|
||||
let tmp_dir = TempDir::new("test_char_device_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the char device;
|
||||
let char_device_path = tmp_dir.path().join("char-device.tmp");
|
||||
|
@ -204,7 +204,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(unix)] // Sockets don't work the same way on Windows
|
||||
fn test_socket_type() {
|
||||
let tmp_dir = TempDir::new("test_socket_type").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the socket;
|
||||
let socket_path = tmp_dir.path().join("socket.tmp");
|
||||
|
|
|
@ -112,12 +112,12 @@ mod test {
|
|||
use std::path::Path;
|
||||
#[cfg(unix)]
|
||||
use std::process::Command;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)] // Windows uses different default permissions
|
||||
fn test_print_file_name() {
|
||||
let tmp_dir = TempDir::new("test_print_file_name").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy);
|
||||
|
||||
// Create the file;
|
||||
|
@ -137,7 +137,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_print_dir_name() {
|
||||
let tmp_dir = TempDir::new("test_print_dir_name").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy);
|
||||
|
||||
// Chreate the directory
|
||||
|
@ -156,7 +156,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(unix)] // Symlinks are hard on Windows
|
||||
fn test_print_symlink_name() {
|
||||
let tmp_dir = TempDir::new("test_symlink_name").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy);
|
||||
|
||||
// Create the file;
|
||||
|
@ -183,7 +183,7 @@ mod test {
|
|||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_print_other_type_name() {
|
||||
let tmp_dir = TempDir::new("test_other_type_name").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::Fancy);
|
||||
|
||||
// Create the pipe;
|
||||
|
@ -208,8 +208,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_print_without_icon_or_color() {
|
||||
let tmp_dir =
|
||||
TempDir::new("test_print_without_icon_or_color").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
let icons = Icons::new(icon::Theme::NoIcon);
|
||||
|
||||
// Create the file;
|
||||
|
|
12
src/sort.rs
12
src/sort.rs
|
@ -91,11 +91,11 @@ mod tests {
|
|||
use crate::flags::Flags;
|
||||
use std::fs::{create_dir, File};
|
||||
use std::process::Command;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[test]
|
||||
fn test_sort_by_meta_by_name_with_dirs_first() {
|
||||
let tmp_dir = TempDir::new("test_dir").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let path_a = tmp_dir.path().join("zzz");
|
||||
|
@ -120,7 +120,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_sort_by_meta_by_name_with_files_first() {
|
||||
let tmp_dir = TempDir::new("test_dir").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let path_a = tmp_dir.path().join("zzz");
|
||||
|
@ -144,7 +144,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_sort_by_meta_by_name_unordered() {
|
||||
let tmp_dir = TempDir::new("test_dir").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let path_a = tmp_dir.path().join("aaa");
|
||||
|
@ -169,7 +169,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_sort_by_meta_by_name_unordered_2() {
|
||||
let tmp_dir = TempDir::new("test_dir").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let path_a = tmp_dir.path().join("zzz");
|
||||
|
@ -194,7 +194,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_sort_by_meta_by_time() {
|
||||
let tmp_dir = TempDir::new("test_dir").expect("failed to create temp dir");
|
||||
let tmp_dir = tempdir().expect("failed to create temp dir");
|
||||
|
||||
// Create the file;
|
||||
let path_a = tmp_dir.path().join("aaa");
|
||||
|
|
Loading…
Reference in a new issue