mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
Suggest alternative when command not found (#6256)
* Suggest alternative when command not found * Add tests for command-not-found suggestions * Put suggestion in label * Fix tests
This commit is contained in:
@ -107,6 +107,19 @@ fn passes_binary_data_between_externals() {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn command_not_found_error_suggests_search_term() {
|
||||
// 'distinct' is not a command, but it is a search term for 'uniq'
|
||||
let actual = nu!(cwd: ".", "ls | distinct");
|
||||
assert!(actual.err.contains("uniq"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn command_not_found_error_suggests_typo_fix() {
|
||||
let actual = nu!(cwd: ".", "benhcmark { echo 'foo'}");
|
||||
assert!(actual.err.contains("benchmark"));
|
||||
}
|
||||
|
||||
mod it_evaluation {
|
||||
use super::nu;
|
||||
use nu_test_support::fs::Stub::{EmptyFile, FileWithContent, FileWithContentToBeTrimmed};
|
||||
|
Reference in New Issue
Block a user