Path migration part 4: various tests (#13373)

# Description
Part 4 of replacing std::path types with nu_path types added in
https://github.com/nushell/nushell/pull/13115. This PR migrates various
tests throughout the code base.
This commit is contained in:
Ian Manske
2024-08-03 08:09:13 +00:00
committed by GitHub
parent 85b06b22d9
commit f4c0d9d45b
13 changed files with 213 additions and 212 deletions

View File

@ -1,6 +1,6 @@
use nu_path::AbsolutePath;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use std::path::PathBuf;
#[test]
fn creates_temp_file() {
@ -9,7 +9,7 @@ fn creates_temp_file() {
cwd: dirs.test(),
"mktemp"
);
let loc = PathBuf::from(output.out.clone());
let loc = AbsolutePath::try_new(&output.out).unwrap();
println!("{:?}", loc);
assert!(loc.exists());
})
@ -22,7 +22,7 @@ fn creates_temp_file_with_suffix() {
cwd: dirs.test(),
"mktemp --suffix .txt tempfileXXX"
);
let loc = PathBuf::from(output.out.clone());
let loc = AbsolutePath::try_new(&output.out).unwrap();
assert!(loc.exists());
assert!(loc.is_file());
assert!(output.out.ends_with(".txt"));
@ -37,8 +37,7 @@ fn creates_temp_directory() {
cwd: dirs.test(),
"mktemp -d"
);
let loc = PathBuf::from(output.out);
let loc = AbsolutePath::try_new(&output.out).unwrap();
assert!(loc.exists());
assert!(loc.is_dir());
})