mirror of
https://github.com/nushell/nushell.git
synced 2025-04-01 11:46:20 +02:00
Add more overlay use usage (#6551)
This commit is contained in:
parent
d08212409f
commit
8564c5371f
@ -191,6 +191,13 @@ impl Command for OverlayUse {
|
|||||||
description: "Create an overlay from a module",
|
description: "Create an overlay from a module",
|
||||||
example: r#"module spam { export def foo [] { "foo" } }
|
example: r#"module spam { export def foo [] { "foo" } }
|
||||||
overlay use spam
|
overlay use spam
|
||||||
|
foo"#,
|
||||||
|
result: None,
|
||||||
|
},
|
||||||
|
Example {
|
||||||
|
description: "Create an overlay from a module and rename it",
|
||||||
|
example: r#"module spam { export def foo [] { "foo" } }
|
||||||
|
overlay use spam as spam_new
|
||||||
foo"#,
|
foo"#,
|
||||||
result: None,
|
result: None,
|
||||||
},
|
},
|
||||||
|
@ -17,6 +17,21 @@ fn add_overlay() {
|
|||||||
assert_eq!(actual_repl.out, "foo");
|
assert_eq!(actual_repl.out, "foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn add_overlay_as_new_name() {
|
||||||
|
let inp = &[
|
||||||
|
r#"module spam { export def foo [] { "foo" } }"#,
|
||||||
|
r#"overlay use spam as spam_new"#,
|
||||||
|
r#"foo"#,
|
||||||
|
];
|
||||||
|
|
||||||
|
let actual = nu!(cwd: "tests/overlays", pipeline(&inp.join("; ")));
|
||||||
|
let actual_repl = nu!(cwd: "tests/overlays", nu_repl_code(inp));
|
||||||
|
|
||||||
|
assert_eq!(actual.out, "foo");
|
||||||
|
assert_eq!(actual_repl.out, "foo");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn add_overlay_twice() {
|
fn add_overlay_twice() {
|
||||||
let inp = &[
|
let inp = &[
|
||||||
|
Loading…
Reference in New Issue
Block a user