mirror of
https://github.com/nushell/nushell.git
synced 2025-08-19 05:02:07 +02:00
Removes export env
command (#6468)
* remove export_env command * remove several export env usage in test code * adjust hiding relative test case * fix clippy * adjust tests * update tests * unignore these tests to expose ut failed * using `use` instead of `overlay use` in some tests * Revert "using `use` instead of `overlay use` in some tests" This reverts commit2ae24b24c3
. * Revert "adjust hiding relative test case" This reverts commit4369af6d05
. * Bring back module example * Revert "update tests" This reverts commit6ae94ef513
. * Fix tests * "Fix" a test * Remove remaining deprecated env functionality * Re-enable environment hiding for `hide` To not break virtualenv since the overlay update is not merged yet * Fix hiding env in `hide` and ignore some tests Co-authored-by: kubouch <kubouch@gmail.com>
This commit is contained in:
@@ -131,7 +131,7 @@ fn prefixed_overlay_keeps_custom_decl() {
|
||||
#[test]
|
||||
fn add_overlay_env() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"$env.FOO"#,
|
||||
];
|
||||
@@ -146,7 +146,7 @@ fn add_overlay_env() {
|
||||
#[test]
|
||||
fn add_prefixed_overlay_env_no_prefix() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use --prefix spam"#,
|
||||
r#"$env.FOO"#,
|
||||
];
|
||||
@@ -239,9 +239,9 @@ fn update_overlay_from_module() {
|
||||
#[test]
|
||||
fn update_overlay_from_module_env() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"module spam { export env FOO { "bar" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "bar" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"$env.FOO"#,
|
||||
];
|
||||
@@ -256,7 +256,7 @@ fn update_overlay_from_module_env() {
|
||||
#[test]
|
||||
fn overlay_use_do_not_eval_twice() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"let-env FOO = "bar""#,
|
||||
r#"overlay hide spam"#,
|
||||
@@ -328,7 +328,7 @@ fn remove_overlay_scoped() {
|
||||
#[test]
|
||||
fn remove_overlay_env() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"overlay hide spam"#,
|
||||
r#"$env.FOO"#,
|
||||
@@ -344,7 +344,7 @@ fn remove_overlay_env() {
|
||||
#[test]
|
||||
fn remove_overlay_scoped_env() {
|
||||
let inp = &[
|
||||
r#"module spam { export env FOO { "foo" } }"#,
|
||||
r#"module spam { export-env { let-env FOO = "foo" } }"#,
|
||||
r#"overlay use spam"#,
|
||||
r#"do { overlay hide spam }"#,
|
||||
r#"$env.FOO"#,
|
||||
@@ -485,7 +485,7 @@ fn remove_overlay_keep_alias() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_overlay_keep_env() {
|
||||
fn remove_overlay_dont_keep_env() {
|
||||
let inp = &[
|
||||
r#"overlay use samples/spam.nu"#,
|
||||
r#"let-env BAGR = `bagr`"#,
|
||||
@@ -496,12 +496,12 @@ fn remove_overlay_keep_env() {
|
||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||
|
||||
assert!(actual.out.contains("bagr"));
|
||||
assert!(actual_repl.out.contains("bagr"));
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
assert!(actual_repl.err.contains("cannot find column"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_overlay_keep_discard_overwritten_decl() {
|
||||
fn remove_overlay_dont_keep_overwritten_decl() {
|
||||
let inp = &[
|
||||
r#"overlay use samples/spam.nu"#,
|
||||
r#"def foo [] { 'bar' }"#,
|
||||
@@ -520,7 +520,7 @@ fn remove_overlay_keep_discard_overwritten_decl() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_overlay_keep_discard_overwritten_alias() {
|
||||
fn remove_overlay_dont_keep_overwritten_alias() {
|
||||
let inp = &[
|
||||
r#"overlay use samples/spam.nu"#,
|
||||
r#"alias bar = `baz`"#,
|
||||
@@ -539,7 +539,7 @@ fn remove_overlay_keep_discard_overwritten_alias() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_overlay_keep_discard_overwritten_env() {
|
||||
fn remove_overlay_dont_keep_overwritten_env() {
|
||||
let inp = &[
|
||||
r#"overlay use samples/spam.nu"#,
|
||||
r#"let-env BAZ = `bagr`"#,
|
||||
@@ -591,7 +591,7 @@ fn remove_overlay_keep_alias_in_latest_overlay() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn remove_overlay_keep_env_in_latest_overlay() {
|
||||
fn remove_overlay_dont_keep_env_in_latest_overlay() {
|
||||
let inp = &[
|
||||
r#"overlay use samples/spam.nu"#,
|
||||
r#"let-env BAGR = `bagr`"#,
|
||||
@@ -604,8 +604,8 @@ fn remove_overlay_keep_env_in_latest_overlay() {
|
||||
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||
|
||||
assert!(actual.out.contains("bagr"));
|
||||
assert!(actual_repl.out.contains("bagr"));
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
assert!(actual_repl.err.contains("cannot find column"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@@ -2,4 +2,4 @@ export def foo [] { "foo" }
|
||||
|
||||
export alias bar = "bar"
|
||||
|
||||
export env BAZ { "baz" }
|
||||
export-env { let-env BAZ = "baz" } }
|
||||
|
Reference in New Issue
Block a user