mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix path type
using PWD from the environment (#12975)
This PR fixes the `path type` command so that it resolves relative paths using PWD from the engine state. As a bonus, it also fixes the issue of `path type` returning an empty string instead of an error when it fails.
This commit is contained in:
@ -74,3 +74,14 @@ fn returns_type_of_existing_file_const() {
|
||||
assert_eq!(actual.out, "dir");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn respects_cwd() {
|
||||
Playground::setup("path_type_respects_cwd", |dirs, sandbox| {
|
||||
sandbox.within("foo").with_files(&[EmptyFile("bar.txt")]);
|
||||
|
||||
let actual = nu!(cwd: dirs.test(), "cd foo; 'bar.txt' | path type");
|
||||
|
||||
assert_eq!(actual.out, "file");
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user