mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 10:45:41 +02:00
add more helpful error for calling a decl that exists in a module (#6752)
* add more helpful error for calling a decl that exists in a module * accord to suggestions * make error more helpful
This commit is contained in:
@ -183,3 +183,17 @@ fn use_export_env_combined() {
|
||||
assert_eq!(actual.out, "foo");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn use_module_creates_accurate_did_you_mean() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
module spam { export def foo [] { "foo" } }; use spam; foo
|
||||
"#
|
||||
)
|
||||
);
|
||||
assert!(actual.err.contains(
|
||||
"command 'foo' was not found but it exists in module 'spam'; try using `spam foo`"
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user