Friendly error message for access beyond end (#6944)

Adds `ShellError::AccessEmptyContent`
This commit is contained in:
WindSoilder
2022-10-30 01:47:50 +08:00
committed by GitHub
parent 7039602e4d
commit 4f7f6a2932
7 changed files with 46 additions and 11 deletions

View File

@ -199,11 +199,17 @@ fn errors_fetching_by_index_out_of_bounds() {
"#
));
assert!(actual.err.contains("Row number too large (max: 3)"),);
assert!(actual.err.contains("Row number too large (max: 2)"),);
assert!(actual.err.contains("too large"),);
})
}
#[test]
fn errors_fetching_by_accessing_empty_list() {
let actual = nu!(cwd: ".", pipeline(r#"[] | get 3"#));
assert!(actual.err.contains("Row number too large (empty content)"),);
}
#[test]
fn quoted_column_access() {
let actual = nu!(