mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 14:28:58 +02:00
Test #13302
This commit is contained in:
@ -91,12 +91,8 @@ fn complete_rec(
|
||||
want_directory,
|
||||
isdir,
|
||||
));
|
||||
} else {
|
||||
completions.push(built);
|
||||
}
|
||||
|
||||
// For https://github.com/nushell/nushell/issues/13204
|
||||
if isdir && options.match_algorithm == MatchAlgorithm::Prefix {
|
||||
if options.match_algorithm == MatchAlgorithm::Prefix {
|
||||
let exact_match = if options.case_sensitive {
|
||||
entry_name.eq(base)
|
||||
} else {
|
||||
@ -106,6 +102,9 @@ fn complete_rec(
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completions.push(built);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
completions.push(built);
|
||||
|
@ -1295,6 +1295,31 @@ fn sort_fuzzy_completions_in_alphabetical_order(mut fuzzy_alpha_sort_completer:
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exact_match() {
|
||||
let (dir, _, engine, stack) = new_partial_engine();
|
||||
|
||||
let mut completer = NuCompleter::new(Arc::new(engine), Arc::new(stack));
|
||||
|
||||
let target_dir = format!("open {}", folder(dir.join("pArTiAL")));
|
||||
let suggestions = completer.complete(&target_dir, target_dir.len());
|
||||
|
||||
// Since it's an exact match, only 'partial' should be suggested, not
|
||||
// 'partial-a' and stuff. Implemented in #13302
|
||||
match_suggestions(
|
||||
&vec![file(dir.join("partial").join("hello.txt"))],
|
||||
&suggestions,
|
||||
);
|
||||
|
||||
let target_dir = format!("open {}", file(dir.join("pArTiAL").join("hello")));
|
||||
let suggestions = completer.complete(&target_dir, target_dir.len());
|
||||
|
||||
match_suggestions(
|
||||
&vec![file(dir.join("partial").join("hello.txt"))],
|
||||
&suggestions,
|
||||
);
|
||||
}
|
||||
|
||||
#[ignore = "was reverted, still needs fixing"]
|
||||
#[rstest]
|
||||
fn alias_offset_bug_7648() {
|
||||
|
Reference in New Issue
Block a user