Skip to content

Commit

Permalink
Fix Bytes doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbb committed Mar 11, 2021
1 parent 876317a commit d2c07b4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,7 @@ pub struct TimestampNanoSecondsWithFrac<
/// # #[derive(Debug, PartialEq)]
/// #[derive(Deserialize, Serialize)]
/// struct Test<'a> {
/// # #[cfg(FALSE)]
/// #[serde_as(as = "Bytes")]
/// array: [u8; 15],
/// #[serde_as(as = "Bytes")]
Expand All @@ -1361,6 +1362,7 @@ pub struct TimestampNanoSecondsWithFrac<
/// }
///
/// let value = Test {
/// # #[cfg(FALSE)]
/// array: b"0123456789ABCDE".clone(),
/// boxed: b"...".to_vec().into_boxed_slice(),
/// cow: Cow::Borrowed(b"FooBar"),
Expand All @@ -1372,6 +1374,13 @@ pub struct TimestampNanoSecondsWithFrac<
/// cow: "Rm9vQmFy",
/// vec: "QWEh",
/// )"#;
/// # drop(expected);
/// # // Create a fake expected value without the array to make the test compile without const generics
/// # let expected = r#"(
/// # boxed: "Li4u",
/// # cow: "Rm9vQmFy",
/// # vec: "QWEh",
/// # )"#;
///
/// assert_eq!(expected, ron::ser::to_string_pretty(&value, Default::default()).unwrap());
/// assert_eq!(value, ron::from_str(&expected).unwrap());
Expand Down

0 comments on commit d2c07b4

Please sign in to comment.