mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:14:56 +02:00
Refactor: Construct IoError
from std::io::Error
instead of std::io::ErrorKind
(#15777)
This commit is contained in:
@ -60,5 +60,5 @@ fn self_path_runtime() {
|
||||
fn self_path_repl() {
|
||||
let actual = nu!("const foo = path self; $foo");
|
||||
assert!(!actual.status.success());
|
||||
assert!(actual.err.contains("nu::shell::io::not_found"));
|
||||
assert!(actual.err.contains("nu::shell::io::file_not_found"));
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ use nu_test_support::playground::Playground;
|
||||
use rstest::rstest;
|
||||
#[cfg(not(windows))]
|
||||
use std::fs;
|
||||
#[cfg(windows)]
|
||||
use std::{fs::OpenOptions, os::windows::fs::OpenOptionsExt};
|
||||
|
||||
#[test]
|
||||
fn removes_a_file() {
|
||||
@ -562,3 +564,26 @@ fn rm_with_tilde() {
|
||||
assert!(!files_exist_at(&["~tilde"], dirs.test()));
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn rm_already_in_use() {
|
||||
Playground::setup("rm_already_in_use", |dirs, sandbox| {
|
||||
sandbox.with_files(&[EmptyFile("i_will_be_used.txt")]);
|
||||
|
||||
let file_path = dirs.root().join("rm_already_in_use/i_will_be_used.txt");
|
||||
let _file = OpenOptions::new()
|
||||
.read(true)
|
||||
.write(false)
|
||||
.share_mode(0) // deny all sharing
|
||||
.open(file_path)
|
||||
.unwrap();
|
||||
|
||||
let outcome = nu!(
|
||||
cwd: dirs.root(),
|
||||
"rm rm_already_in_use/i_will_be_used.txt"
|
||||
);
|
||||
|
||||
assert!(outcome.err.contains("nu::shell::io::already_in_use"));
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user