message: chore: add test error to jsonbytes
diff: @@ -98,3 +98,37 @@ impl<'de> serde::Deserialize<'de> for JsonBytes {
  deserializer.deserialize_str(BytesVisitor)
  }
  }
  +
  +#[cfg(test)]
  +mod test {
  + use super::JsonBytes;
  + use serde_derive::{Deserialize, Serialize};
  + use serde_json;
  +
  + #[test]
  + fn test_toml_de_error() {
  + #[derive(Deserialize, Serialize, Debug)]
  + struct Test {
  + bytes: JsonBytes,
  + }
  +
  + let invalid_prefixed = r#"{"bytes": "2143"}"#;
  + let invalid_length = r#"{"bytes" : "0x0"}"#;
  + let illegal_char = r#"{"bytes":"0xgh"}"#;
  +
  + let e = serde_json::from_str::<Test>(invalid_prefixed);
  + assert_eq!(r#"invalid value: string "2143", expected a 0x-prefixed hex string at line 1 column 16"#, format!("{}", e.unwrap_err()));
  +
  + let e = serde_json::from_str::<Test>(invalid_length);
  + assert_eq!(
  + r#"invalid length 3, expected even length at line 1 column 16"#,
  + format!("{}", e.unwrap_err())
  + );
  +
  + let e = serde_json::from_str::<Test>(illegal_char);
  + assert_eq!(
  + r#"Invalid character at line 1 column 15"#,
  + format!("{}", e.unwrap_err())
  + );
  + }
  +}
  