about summary refs log tree commit diff
path: root/library/std/src/sys_common/bytestring/tests.rs
blob: 1685f087d183e49f81d35ced27e8f480c9cada81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
}