mirror of
https://github.com/nushell/nushell.git
synced 2025-02-22 05:21:44 +01:00
# Description Fixes #14909 with the same technique used in #12820 for `stor insert`. Single quotes (and others) now work properly in strings passed to `stor update`. Also did some minor refactoring on `stor insert` so it matches the changes in `stor update`. # User-Facing Changes Bug-fix. # Tests + Formatting Test added for this scenario. - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting N/A
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn stor_insert() {
|
|
let actual = nu!(pipeline(
|
|
r#"
|
|
stor create --table-name test_table --columns { id: int, value: str };
|
|
stor insert -t test_table --data-record {
|
|
id: 1
|
|
value: "'Initial value'"
|
|
};
|
|
stor open | query db 'select value from test_table' | get 0.value
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "'Initial value'");
|
|
}
|
|
|
|
#[test]
|
|
fn stor_update_with_quote() {
|
|
let actual = nu!(pipeline(
|
|
r#"
|
|
stor create --table-name test_table --columns { id: int, value: str };
|
|
stor insert -t test_table --data-record {
|
|
id: 1
|
|
value: "'Initial value'"
|
|
};
|
|
stor update -t test_table --where-clause 'id = 1' --update-record {
|
|
id: 1
|
|
value: "This didn't work, but should now."
|
|
};
|
|
stor open | query db 'select value from test_table' | get 0.value
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "This didn't work, but should now.");
|
|
}
|