Add test for fix of issue #7754 (#7756)

Fix already landed with #7779
This commit is contained in:
Xoffio 2023-01-19 05:19:27 -05:00 committed by GitHub
parent 3b5172a8fa
commit 6a43e1a64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -834,3 +834,22 @@ fn alias_offset_bug_7748() {
let _suggestions = completer.complete("e", 1);
//println!(" --------- suggestions: {:?}", suggestions);
}
#[rstest]
fn alias_offset_bug_7754() {
let (dir, _, mut engine, mut stack) = new_engine();
// Create an alias
let alias = r#"alias ll = ls -l"#;
assert!(support::merge_input(alias.as_bytes(), &mut engine, &mut stack, dir.clone()).is_ok());
let mut completer = NuCompleter::new(std::sync::Arc::new(engine), stack);
// Issue #7754
// Nushell crashes when an alias name is shorter than the alias command
// and the alias command contains pipes.
// This crashes before PR #7756
let _suggestions = completer.complete("ll -a | c", 9);
//println!(" --------- suggestions: {:?}", suggestions);
}