diff options
Diffstat (limited to 'library/std/src/sys_common/bytestring.rs')
| -rw-r--r-- | library/std/src/sys_common/bytestring.rs | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/library/std/src/sys_common/bytestring.rs b/library/std/src/sys_common/bytestring.rs index dccc3bc4a19..97fba60c271 100644 --- a/library/std/src/sys_common/bytestring.rs +++ b/library/std/src/sys_common/bytestring.rs @@ -1,5 +1,8 @@ #![allow(dead_code)] +#[cfg(test)] +mod tests; + use crate::fmt::{Formatter, Result, Write}; use core::str::lossy::{Utf8Lossy, Utf8LossyChunk}; @@ -21,26 +24,3 @@ pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter<'_>) -> Result { } f.write_str("\"") } - -#[cfg(test)] -mod tests { - use super::*; - use crate::fmt::{Debug, Formatter, Result}; - - #[test] - fn smoke() { - struct Helper<'a>(&'a [u8]); - - impl Debug for Helper<'_> { - fn fmt(&self, f: &mut Formatter<'_>) -> Result { - debug_fmt_bytestring(self.0, f) - } - } - - let input = b"\xF0hello,\tworld"; - let expected = r#""\xF0hello,\tworld""#; - let output = format!("{:?}", Helper(input)); - - assert!(output == expected); - } -} |
