Skip to content

Commit

Permalink
add unit test for deserialize bytes from array
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Perlaki <[email protected]>
  • Loading branch information
lperlaki committed Jul 5, 2024
1 parent bf432c0 commit 5c38e5f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ciborium/src/value/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,3 +642,18 @@ impl Value {
T::deserialize(Deserializer(self))
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn deserialize_bytes_from_array() {
let value = Value::serialized(&[1, 2, 3, 4]).unwrap();
assert!(value.is_array());

let bytes = value.deserialized::<serde_bytes::ByteArray<4>>().unwrap();

assert_eq!(bytes, &[1, 2, 3, 4]);
}
}

0 comments on commit 5c38e5f

Please sign in to comment.