Revert "fix $env.FILE_PWD and $env.CURRENT_FILE inside use (#13958)" (#14057)

This reverts commit 5002d87af4 from pr
#13958

It seems that something unexpected happened from
[@ealap](https://github.com/ealap)'s report. Thanks!

Reopen: #13425
This commit is contained in:
Wind
2024-10-11 14:45:42 +08:00
committed by GitHub
parent e43632fd95
commit 44be445b57
2 changed files with 7 additions and 67 deletions

View File

@ -308,47 +308,3 @@ fn can_use_sub_subname_from_submodule() {
let actual = nu!(inp);
assert_eq!(actual.out, "bar")
}
#[test]
fn test_use_with_printing_file_pwd() {
Playground::setup("use_with_printing_file_pwd", |dirs, nu| {
let file = dirs.test().join("mod.nu");
nu.with_files(&[FileWithContent(
file.as_os_str().to_str().unwrap(),
r#"
export-env {
print $env.FILE_PWD
}
"#,
)]);
let actual = nu!(
cwd: dirs.test(),
"use ."
);
assert_eq!(actual.out, dirs.test().to_string_lossy());
});
}
#[test]
fn test_use_with_printing_current_file() {
Playground::setup("use_with_printing_current_file", |dirs, nu| {
let file = dirs.test().join("mod.nu");
nu.with_files(&[FileWithContent(
file.as_os_str().to_str().unwrap(),
r#"
export-env {
print $env.CURRENT_FILE
}
"#,
)]);
let actual = nu!(
cwd: dirs.test(),
"use ."
);
assert_eq!(actual.out, dirs.test().join("mod.nu").to_string_lossy());
});
}