From 40d4b798dfd109e9f211d4eaff597aed5f0f18b8 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:05:57 +0200 Subject: [PATCH 01/12] =?UTF-8?q?build:=20=E2=9E=95=20Update=20dependencie?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 46 ++------------------------------------------- espflash/Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a6beb3a..7e8c35de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ dependencies = [ "gimli", "object", "rustc-demangle", - "smallvec 1.10.0", + "smallvec", ] [[package]] @@ -69,15 +69,6 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" -[[package]] -name = "array-init" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayvec" version = "0.5.2" @@ -921,7 +912,6 @@ dependencies = [ "regex", "rppal", "serde", - "serde-hex", "serialport", "sha2", "slip-codec", @@ -1453,12 +1443,6 @@ dependencies = [ "libc", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "md5" version = "0.7.0" @@ -1555,12 +1539,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "num-traits" version = "0.2.15" @@ -1699,7 +1677,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "smallvec 1.10.0", + "smallvec", "windows-sys 0.45.0", ] @@ -1975,17 +1953,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-hex" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" -dependencies = [ - "array-init", - "serde", - "smallvec 0.6.14", -] - [[package]] name = "serde_derive" version = "1.0.158" @@ -2121,15 +2088,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "399892aa22101014dcebb84944dc950f6d02695e91ea5f7e11baf02998fc59e2" -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - [[package]] name = "smallvec" version = "1.10.0" diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index 2a5a2002..44c0a325 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -37,6 +37,7 @@ directories-next = { version = "2.0.0", optional = true } env_logger = { version = "0.10.0", optional = true } esp-idf-part = "0.2.0" flate2 = "1.0.25" +hex = { version = "0.4.3", features = ["serde"] } indicatif = { version = "0.17.2", optional = true } lazy_static = { version = "1.4.0", optional = true } log = "0.4.17" @@ -45,7 +46,6 @@ parse_int = { version = "0.6.0", optional = true } regex = { version = "1.7.1", optional = true } rppal = { version = "0.14.1", optional = true } serde = { version = "1.0.152", features = ["derive"] } -serde-hex = { version = "0.1.0", optional = true } serialport = "4.2.0" sha2 = "0.10.6" slip-codec = "0.3.3" @@ -66,11 +66,11 @@ cli = [ "dep:dialoguer", "dep:directories-next", "dep:env_logger", + "dep:hex", "dep:indicatif", "dep:lazy_static", "dep:parse_int", "dep:regex", - "dep:serde-hex", "dep:update-informer", ] raspberry = ["dep:rppal"] From 268388793915cbfc421b91a76dd21d8cda92867f Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:06:52 +0200 Subject: [PATCH 02/12] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20hex=5Fu16=20par?= =?UTF-8?q?ser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 9db95097..078a0461 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -15,7 +15,6 @@ use std::{ use directories_next::ProjectDirs; use miette::{IntoDiagnostic, Result, WrapErr}; use serde::{Deserialize, Serialize}; -use serde_hex::{Compact, SerHex}; use serialport::UsbPortInfo; /// A configured, known serial connection @@ -35,13 +34,32 @@ pub struct Connection { #[derive(Debug, Deserialize, Serialize, Default, Clone)] pub struct UsbDevice { /// USB Vendor ID - #[serde(with = "SerHex::")] + #[serde(deserialize_with = "parse_hex_u16")] pub vid: u16, /// USB Product ID - #[serde(with = "SerHex::")] + #[serde(deserialize_with = "parse_hex_u16")] pub pid: u16, } +fn parse_hex_u16<'de, D>(deserializer: D) -> Result +where + D: serde::Deserializer<'de>, +{ + let s = String::deserialize(deserializer)?; + // Check if the string is less than 4 digits, if so, pad it with 0s + let bytes = hex::decode(if s.len() % 2 == 1 { + format!("0{}", s) + } else { + s.to_owned() + }) + .map_err(serde::de::Error::custom)?; + let padding = vec![0; 2 - bytes.len()]; + // Apend the padding before the bytes + let vec = [&padding[..], &bytes[..]].concat(); + let decimal = u16::from_be_bytes(vec.try_into().unwrap()); + Ok(decimal) +} + impl UsbDevice { /// Check if the given USB port matches this device pub fn matches(&self, port: &UsbPortInfo) -> bool { From c340b67e2389101ba72fc3a9a12490fd15136b7f Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:07:23 +0200 Subject: [PATCH 03/12] =?UTF-8?q?test:=20=F0=9F=A7=AA=20Add=20test=20fn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 078a0461..ecbd05b8 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -112,3 +112,53 @@ impl Config { .wrap_err_with(|| format!("Failed to write config to {}", self.save_path.display())) } } + +#[cfg(test)] +mod tests { + use super::*; + use serde::Deserialize; + + #[derive(Debug, Deserialize)] + struct TestData { + #[serde(deserialize_with = "parse_hex_u16")] + value: u16, + } + + #[test] + fn test_parse_hex_u16() { + // Test no padding + let input = "aaaa"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0xaaaa); + let input = "1234"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0x1234); + + // Test padding + let input = "a"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0x0a); + + let input = "10"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0x10); + + let input = "100"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0x0100); + + // Test uppercase + let input = "A1B2"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0xA1B2); + + // Test invalid + let input = "gg"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert!(result.is_err()); + + let input = "10gg"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert!(result.is_err()); + } +} From 139bec39e00cdf89927f21279c6bcf74ba48afdd Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:14:15 +0200 Subject: [PATCH 04/12] =?UTF-8?q?build:=20=E2=AC=86=EF=B8=8F=20Make=20hex?= =?UTF-8?q?=20optional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 4 ++++ espflash/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7e8c35de..c68d7ab7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -904,6 +904,7 @@ dependencies = [ "env_logger 0.10.0", "esp-idf-part", "flate2", + "hex 0.4.3", "indicatif", "lazy_static", "log", @@ -1147,6 +1148,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "home" diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index 44c0a325..ab2ca4c5 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -37,7 +37,7 @@ directories-next = { version = "2.0.0", optional = true } env_logger = { version = "0.10.0", optional = true } esp-idf-part = "0.2.0" flate2 = "1.0.25" -hex = { version = "0.4.3", features = ["serde"] } +hex = { version = "0.4.3", features = ["serde"], optional = true } indicatif = { version = "0.17.2", optional = true } lazy_static = { version = "1.4.0", optional = true } log = "0.4.17" From 35fad85353f5d3a0a8ae3af46dbcd7c536a2241c Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:19:24 +0200 Subject: [PATCH 05/12] =?UTF-8?q?fix:=20=F0=9F=8E=A8=20Fix=20clippy=20warn?= =?UTF-8?q?ings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index ecbd05b8..12d3e0db 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -50,7 +50,7 @@ where let bytes = hex::decode(if s.len() % 2 == 1 { format!("0{}", s) } else { - s.to_owned() + s }) .map_err(serde::de::Error::custom)?; let padding = vec![0; 2 - bytes.len()]; From 8737cea9203476f9832ba544fb0245e135b92a69 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 10:55:42 +0200 Subject: [PATCH 06/12] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20serialization?= =?UTF-8?q?=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 12d3e0db..1f8bdce1 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -34,10 +34,10 @@ pub struct Connection { #[derive(Debug, Deserialize, Serialize, Default, Clone)] pub struct UsbDevice { /// USB Vendor ID - #[serde(deserialize_with = "parse_hex_u16")] + #[serde(serialize_with = "parse_u16_hex", deserialize_with = "parse_hex_u16")] pub vid: u16, /// USB Product ID - #[serde(deserialize_with = "parse_hex_u16")] + #[serde(serialize_with = "parse_u16_hex", deserialize_with = "parse_hex_u16")] pub pid: u16, } @@ -60,6 +60,14 @@ where Ok(decimal) } +fn parse_u16_hex(decimal: &u16, serializer: S) -> Result +where + S: serde::Serializer, +{ + let hex_string = format!("{:04x}", decimal); + serializer.serialize_str(&hex_string) +} + impl UsbDevice { /// Check if the given USB port matches this device pub fn matches(&self, port: &UsbPortInfo) -> bool { From f53a197ee9a22cc1f5d466e5f507591caa317727 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 11:48:25 +0200 Subject: [PATCH 07/12] =?UTF-8?q?test:=20=F0=9F=A7=AA=20Add=20test=20fn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 1f8bdce1..b23d351a 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -126,9 +126,9 @@ mod tests { use super::*; use serde::Deserialize; - #[derive(Debug, Deserialize)] + #[derive(Debug, Deserialize, Serialize)] struct TestData { - #[serde(deserialize_with = "parse_hex_u16")] + #[serde(serialize_with = "parse_u16_hex", deserialize_with = "parse_hex_u16")] value: u16, } @@ -169,4 +169,32 @@ mod tests { let result: Result = toml::from_str(&format!("value = \"{}\"", input)); assert!(result.is_err()); } + + #[test] + fn test_parse_u16_hex() { + // Valid hexadecimal input with 1 digit + let input = "1"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0x1); + + // Valid hexadecimal input with 2 digits + let input = "ff"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0xff); + + // Valid hexadecimal input with 3 digits + let input = "b1a"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0xb1a); + + // Valid hexadecimal input with 4 digits + let input = "abc1"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert_eq!(result.unwrap().value, 0xabc1); + + // Invalid input (non-hexadecimal character) + let input = "xyz"; + let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + assert!(result.is_err()); + } } From d1fc1cc99246c6e613579b0bd92b3135a663ee17 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 12:14:33 +0200 Subject: [PATCH 08/12] =?UTF-8?q?fix:=20=E2=9C=A8=20Avoid=20panicking=20by?= =?UTF-8?q?=20underflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index b23d351a..8dac5151 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -53,7 +53,7 @@ where s }) .map_err(serde::de::Error::custom)?; - let padding = vec![0; 2 - bytes.len()]; + let padding = vec![0; 2_usize.saturating_sub(bytes.len())]; // Apend the padding before the bytes let vec = [&padding[..], &bytes[..]].concat(); let decimal = u16::from_be_bytes(vec.try_into().unwrap()); From 10a85901be1931da53e6ee73163b1dfb3f09e756 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 12:24:08 +0200 Subject: [PATCH 09/12] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Remove=20confusing?= =?UTF-8?q?=20docstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 8dac5151..7e61703d 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -46,7 +46,6 @@ where D: serde::Deserializer<'de>, { let s = String::deserialize(deserializer)?; - // Check if the string is less than 4 digits, if so, pad it with 0s let bytes = hex::decode(if s.len() % 2 == 1 { format!("0{}", s) } else { From fe56b86298e8ee3c1b40d5da0fcf2624913a016f Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 12:24:20 +0200 Subject: [PATCH 10/12] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Remove=20confusing?= =?UTF-8?q?=20docstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index 7e61703d..bdda1507 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -53,7 +53,6 @@ where }) .map_err(serde::de::Error::custom)?; let padding = vec![0; 2_usize.saturating_sub(bytes.len())]; - // Apend the padding before the bytes let vec = [&padding[..], &bytes[..]].concat(); let decimal = u16::from_be_bytes(vec.try_into().unwrap()); Ok(decimal) From b0a7f0699870f806b787613a6d88f9e0eddcf3fb Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 12:26:39 +0200 Subject: [PATCH 11/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20Improve=20test=20?= =?UTF-8?q?format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index bdda1507..c01552c7 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -133,38 +133,31 @@ mod tests { #[test] fn test_parse_hex_u16() { // Test no padding - let input = "aaaa"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "aaaa""#); assert_eq!(result.unwrap().value, 0xaaaa); - let input = "1234"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + + let result: Result = toml::from_str(r#"value = "1234""#); assert_eq!(result.unwrap().value, 0x1234); // Test padding - let input = "a"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "a""#); assert_eq!(result.unwrap().value, 0x0a); - let input = "10"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "10""#); assert_eq!(result.unwrap().value, 0x10); - let input = "100"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "100""#); assert_eq!(result.unwrap().value, 0x0100); // Test uppercase - let input = "A1B2"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "A1B2""#); assert_eq!(result.unwrap().value, 0xA1B2); // Test invalid - let input = "gg"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "gg""#); assert!(result.is_err()); - let input = "10gg"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "10gg""#); assert!(result.is_err()); } From 2cea9fb82542ea1ec081e010a192834ad9f53aa6 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Apr 2023 12:37:33 +0200 Subject: [PATCH 12/12] =?UTF-8?q?style:=20=F0=9F=8E=A8=20Improve=20test=20?= =?UTF-8?q?format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index c01552c7..51848b6e 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -164,28 +164,23 @@ mod tests { #[test] fn test_parse_u16_hex() { // Valid hexadecimal input with 1 digit - let input = "1"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "1""#); assert_eq!(result.unwrap().value, 0x1); // Valid hexadecimal input with 2 digits - let input = "ff"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "ff""#); assert_eq!(result.unwrap().value, 0xff); // Valid hexadecimal input with 3 digits - let input = "b1a"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "b1a""#); assert_eq!(result.unwrap().value, 0xb1a); // Valid hexadecimal input with 4 digits - let input = "abc1"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "abc1""#); assert_eq!(result.unwrap().value, 0xabc1); // Invalid input (non-hexadecimal character) - let input = "xyz"; - let result: Result = toml::from_str(&format!("value = \"{}\"", input)); + let result: Result = toml::from_str(r#"value = "xyz""#); assert!(result.is_err()); } }