Add insert/update to lists (#4873)

This commit is contained in:
JT
2022-03-19 10:12:54 +13:00
committed by GitHub
parent 983d115bc0
commit b293282e9b
5 changed files with 119 additions and 8 deletions

View File

@ -71,3 +71,27 @@ fn upsert_column_missing() {
assert!(actual.err.contains("cannot find column"));
}
#[test]
fn update_list() {
let actual = nu!(
cwd: ".", pipeline(
r#"
[1, 2, 3] | update 1 abc | to json -r
"#
));
assert_eq!(actual.out, r#"[1,"abc",3]"#);
}
#[test]
fn update_past_end_list() {
let actual = nu!(
cwd: ".", pipeline(
r#"
[1, 2, 3] | update 5 abc | to json -r
"#
));
assert!(actual.err.contains("too large"));
}