Change parser cwd when running a file (#7134)

* Change parser cwd when running a file

* Add test

* Add missing file
This commit is contained in:
Jakub Žádník
2022-11-15 00:05:27 +01:00
committed by GitHub
parent 336df6c65e
commit 81b12d02ec
4 changed files with 25 additions and 1 deletions

View File

@ -2,6 +2,15 @@ use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
#[test]
fn source_file_relative_to_file() {
let actual = nu!(cwd: "tests/parsing/samples", r#"
nu source_file_relative.nu
"#);
assert_eq!(actual.out, "5");
}
#[test]
fn run_nu_script_single_line() {
let actual = nu!(cwd: "tests/parsing/samples", r#"

View File

@ -0,0 +1 @@
source single_line.nu