Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix upsert index of zero #7350

Merged
merged 3 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update
  • Loading branch information
Kangaxx-0 committed Dec 6, 2022
commit 57a3b42ffaf0d514bd52edf60078848904771508
2 changes: 0 additions & 2 deletions crates/nu-command/src/filters/upsert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ fn upsert(
for idx in 0..*val {
if let Some(v) = input.next() {
pre_elems.push(v);
} else if idx == 0 {
return Err(ShellError::AccessEmptyContent(*span));
} else {
return Err(ShellError::AccessBeyondEnd(idx, *span));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/nu-command/tests/commands/upsert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ fn upsert_empty() {
r#"[] | upsert 1 1"#
));

assert!(actual.err.contains("index too large (empty content)"));
assert!(actual.err.contains("index too large (max: 0)"));
}