mirror of
https://github.com/nushell/nushell.git
synced 2025-06-05 09:36:44 +02:00
test: vibe coded
This commit is contained in:
parent
50cb7623ac
commit
27c3fd670c
@ -2258,6 +2258,30 @@ fn extern_custom_completion_short_flag(mut extern_completer: NuCompleter) {
|
|||||||
match_suggestions(&expected, &suggestions);
|
match_suggestions(&expected, &suggestions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// When we're completing the flag name itself, not its value,
|
||||||
|
/// custom completions should not be used
|
||||||
|
#[rstest]
|
||||||
|
fn custom_completion_flag_name_not_value(mut extern_completer: NuCompleter) {
|
||||||
|
let suggestions = extern_completer.complete("spam --f", 8);
|
||||||
|
assert!(
|
||||||
|
suggestions.iter().any(|s| s.value == "--foo"),
|
||||||
|
"Should contain --foo flag"
|
||||||
|
);
|
||||||
|
let should_not_contain: Vec<_> = vec!["cat", "dog", "eel"];
|
||||||
|
for item in should_not_contain {
|
||||||
|
assert!(
|
||||||
|
!suggestions.iter().any(|s| s.value == item),
|
||||||
|
"Should not contain custom completion {}",
|
||||||
|
item
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also test with partial short flag
|
||||||
|
let suggestions = extern_completer.complete("spam -f", 7);
|
||||||
|
assert_eq!(1, suggestions.len(), "Should only have one suggestion");
|
||||||
|
assert_eq!("-f", suggestions[0].value, "Should suggest -f flag");
|
||||||
|
}
|
||||||
|
|
||||||
#[rstest]
|
#[rstest]
|
||||||
fn extern_complete_flags(mut extern_completer: NuCompleter) {
|
fn extern_complete_flags(mut extern_completer: NuCompleter) {
|
||||||
let suggestions = extern_completer.complete("spam -", 6);
|
let suggestions = extern_completer.complete("spam -", 6);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user