Fix conditional unused in test
This commit is contained in:
parent
9cfacbea12
commit
c648cb0ff0
|
@ -1,8 +1,10 @@
|
||||||
|
#[cfg(not(windows))]
|
||||||
use nu_path::AbsolutePath;
|
use nu_path::AbsolutePath;
|
||||||
use nu_test_support::fs::{files_exist_at, Stub::EmptyFile};
|
use nu_test_support::fs::{files_exist_at, Stub::EmptyFile};
|
||||||
use nu_test_support::nu;
|
use nu_test_support::nu;
|
||||||
use nu_test_support::playground::Playground;
|
use nu_test_support::playground::Playground;
|
||||||
use rstest::rstest;
|
use rstest::rstest;
|
||||||
|
#[cfg(not(windows))]
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
@ -405,16 +407,19 @@ fn removes_file_after_cd() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
struct Cleanup<'a> {
|
struct Cleanup<'a> {
|
||||||
dir_to_clean: &'a AbsolutePath,
|
dir_to_clean: &'a AbsolutePath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
fn set_dir_read_only(directory: &AbsolutePath, read_only: bool) {
|
fn set_dir_read_only(directory: &AbsolutePath, read_only: bool) {
|
||||||
let mut permissions = fs::metadata(directory).unwrap().permissions();
|
let mut permissions = fs::metadata(directory).unwrap().permissions();
|
||||||
permissions.set_readonly(read_only);
|
permissions.set_readonly(read_only);
|
||||||
fs::set_permissions(directory, permissions).expect("failed to set directory permissions");
|
fs::set_permissions(directory, permissions).expect("failed to set directory permissions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
impl<'a> Drop for Cleanup<'a> {
|
impl<'a> Drop for Cleanup<'a> {
|
||||||
/// Restores write permissions to the given directory so that the Playground can be successfully
|
/// Restores write permissions to the given directory so that the Playground can be successfully
|
||||||
/// cleaned up.
|
/// cleaned up.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user