Added fix for #7970 - Upgraded toml crate version from version from 0.5.8 to 0.7.1 for package nu-command (#7990)

# Description

Added fix for #7970 - Upgraded toml crate version from version from
0.5.8 to 0.7.1 for package nu-command

# Tests + Formatting

Added two tests to support the toml upgrade.

- `cargo test --package nu-command --lib -- formats::from::toml::tests
--nocapture`

Executed all tests.

- `cargo test --workspace`

---------

Co-authored-by: Nitin Londhe <nitin.londhe@genmills.com>
This commit is contained in:
Nitin Londhe 2023-02-07 01:45:14 +05:30 committed by GitHub
parent bea7ec33c1
commit 1f01b6438f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 91 additions and 3 deletions

56
Cargo.lock generated
View File

@ -2566,6 +2566,15 @@ dependencies = [
"nom",
]
[[package]]
name = "nom8"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
dependencies = [
"memchr",
]
[[package]]
name = "notify"
version = "4.0.17"
@ -2789,7 +2798,7 @@ dependencies = [
"terminal_size 0.2.1",
"thiserror",
"titlecase",
"toml",
"toml 0.7.1",
"trash",
"umask",
"unicode-segmentation",
@ -4593,6 +4602,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@ -5259,6 +5277,40 @@ dependencies = [
"serde",
]
[[package]]
name = "toml"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "772c1426ab886e7362aedf4abc9c0d1348a979517efedfc25862944d10137af0"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90a238ee2e6ede22fb95350acc78e21dc40da00bb66c0334bde83de4ed89424e"
dependencies = [
"indexmap",
"nom8",
"serde",
"serde_spanned",
"toml_datetime",
]
[[package]]
name = "tower-service"
version = "0.3.2"
@ -5885,7 +5937,7 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
dependencies = [
"toml",
"toml 0.5.9",
]
[[package]]

View File

@ -86,7 +86,7 @@ sysinfo = "0.27.7"
terminal_size = "0.2.1"
thiserror = "1.0.31"
titlecase = "2.0.0"
toml = "0.5.8"
toml = "0.7.1"
unicode-segmentation = "1.8.0"
url = "2.2.1"
percent-encoding = "2.2.0"

View File

@ -125,4 +125,40 @@ mod tests {
test_examples(FromToml {})
}
#[test]
fn string_to_toml_value_passes() {
let input_string = String::from(
r#"
command.build = "go build"
[command.deploy]
script = "./deploy.sh"
"#,
);
let span = Span::test_data();
let result = convert_string_to_value(input_string, span);
assert!(result.is_ok());
}
#[test]
fn string_to_toml_value_fails() {
let input_string = String::from(
r#"
command.build =
[command.deploy]
script = "./deploy.sh"
"#,
);
let span = Span::test_data();
let result = convert_string_to_value(input_string, span);
assert!(result.is_err());
}
}