diff --git a/Cargo.lock b/Cargo.lock index 4bea8c1..d00d47f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "adler" version = "1.0.2" @@ -90,12 +92,6 @@ dependencies = [ "miniz_oxide", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "getrandom" version = "0.2.3" @@ -140,10 +136,10 @@ version = "0.1.5" dependencies = [ "bzip2", "flate2", - "rand 0.8.4", + "rand", "strsim", "tar", - "tempdir", + "tempfile", "walkdir", "xz2", "zip", @@ -179,19 +175,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.4" @@ -200,7 +183,8 @@ checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.3", + "rand_core", + "rand_hc", ] [[package]] @@ -210,24 +194,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.3", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.3" @@ -238,12 +207,12 @@ dependencies = [ ] [[package]] -name = "rdrand" -version = "0.4.0" +name = "rand_hc" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.3.1", + "rand_core", ] [[package]] @@ -302,13 +271,17 @@ dependencies = [ ] [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "rand 0.4.6", + "cfg-if", + "libc", + "rand", + "redox_syscall", "remove_dir_all", + "winapi", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2eaa1f1..6e64f08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ xz2 = "0.1.6" zip = "0.5.11" [dev-dependencies] -tempdir = "0.3.7" +tempfile = "3.2.0" rand = { version = "0.8.3", default-features = false, features = ["small_rng", "std"] } [profile.release] diff --git a/tests/compress_and_decompress.rs b/tests/compress_and_decompress.rs index d08ad56..d8683dc 100644 --- a/tests/compress_and_decompress.rs +++ b/tests/compress_and_decompress.rs @@ -6,7 +6,6 @@ use std::{ use ouch::{cli::Command, commands::run, oof}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; -use tempdir::TempDir; #[test] /// Tests each format that supports multiple files with random input. @@ -39,10 +38,13 @@ fn test_compression_and_decompression(format: &str) -> bool { // System temporary directory depends on the platform // For linux it is /tmp let system_tmp = env::temp_dir(); + // Create a folder that will be deleted on drop - let testing_dir = String::from("ouch-testing-") + format; - let testing_dir = TempDir::new_in(system_tmp, &testing_dir).expect("Could not create tempdir"); - let testing_dir = testing_dir.path(); + let testing_dir = tempfile::Builder::new() + .prefix("ouch-testing") + .tempdir_in(system_tmp) + .expect("Could not create testing_dir"); + let testing_dir_path = testing_dir.path(); // Quantity of compressed files vary from 1 to 10 let quantity_of_files = rng.next_u32() % 10 + 1; @@ -50,8 +52,8 @@ fn test_compression_and_decompression(format: &str) -> bool { let contents_of_files: Vec = (0..quantity_of_files).map(|_| generate_random_file_content(&mut rng)).collect(); - let mut file_paths = create_files(&testing_dir, &contents_of_files); - let compressed_archive_path = compress_files(&testing_dir, &file_paths, &format); + let mut file_paths = create_files(&testing_dir_path, &contents_of_files); + let compressed_archive_path = compress_files(&testing_dir_path, &file_paths, &format); let mut extracted_paths = extract_files(&compressed_archive_path); // // If you want to visualize the compressed and extracted files in the temporary directory