Initial support for parse-time constants (#7436)

This commit is contained in:
Jakub Žádník
2022-12-22 00:21:03 +02:00
committed by GitHub
parent fa8629300f
commit 3a2c7900d6
18 changed files with 788 additions and 242 deletions

View File

@ -293,3 +293,25 @@ fn source_env_is_scoped() {
assert!(actual.err.contains("executable was not found"));
})
}
#[test]
fn source_env_const_file() {
Playground::setup("source_env_const_file", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"spam.nu",
r#"
let-env FOO = 'foo'
"#,
)]);
let inp = &[
r#"const file = 'spam.nu'"#,
r#"source-env $file"#,
r#"$env.FOO"#,
];
let actual = nu!(cwd: dirs.test(), pipeline(&inp.join("; ")));
assert_eq!(actual.out, "foo");
})
}