mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:15:42 +02:00
Add insert and update back (#4864)
This commit is contained in:
@ -6,7 +6,7 @@ fn sets_the_column() {
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open cargo_sample.toml
|
||||
| upsert dev-dependencies.pretty_assertions "0.7.0"
|
||||
| update dev-dependencies.pretty_assertions "0.7.0"
|
||||
| get dev-dependencies.pretty_assertions
|
||||
"#
|
||||
));
|
||||
@ -21,7 +21,7 @@ fn sets_the_column_from_a_block_run_output() {
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open cargo_sample.toml
|
||||
| upsert dev-dependencies.pretty_assertions { open cargo_sample.toml | get dev-dependencies.pretty_assertions | inc --minor }
|
||||
| update dev-dependencies.pretty_assertions { open cargo_sample.toml | get dev-dependencies.pretty_assertions | inc --minor }
|
||||
| get dev-dependencies.pretty_assertions
|
||||
"#
|
||||
));
|
||||
@ -35,7 +35,7 @@ fn sets_the_column_from_a_block_full_stream_output() {
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
wrap content
|
||||
| upsert content { open --raw cargo_sample.toml | lines | first 5 }
|
||||
| update content { open --raw cargo_sample.toml | lines | first 5 }
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
"#
|
||||
@ -50,7 +50,7 @@ fn sets_the_column_from_a_subexpression() {
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
wrap content
|
||||
| upsert content (open --raw cargo_sample.toml | lines | first 5)
|
||||
| update content (open --raw cargo_sample.toml | lines | first 5)
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
"#
|
||||
@ -58,3 +58,16 @@ fn sets_the_column_from_a_subexpression() {
|
||||
|
||||
assert_eq!(actual.out, "true");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn upsert_column_missing() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
open cargo_sample.toml
|
||||
| update dev-dependencies.new_assertions "0.7.0"
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.err.contains("cannot find column"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user