Skip to content

Commit 2873d80

Browse files
committed
tests: Actually test skip_debug for prost::Oneof
1 parent 2fc7132 commit 2873d80

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/src/skip_debug.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ pub enum OneofWithEnumCustomDebug {
3737
#[prost(enumeration = "BasicEnumeration", tag = "10")]
3838
Enumeration(i32),
3939
}
40+
impl fmt::Debug for OneofWithEnumCustomDebug {
41+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
42+
f.write_str("OneofWithEnumCustomDebug {..}")
43+
}
44+
}
4045

4146
#[derive(Clone, PartialEq, prost::Message)]
4247
#[prost(skip_debug)]
@@ -54,10 +59,12 @@ impl fmt::Debug for MessageWithOneofCustomDebug {
5459
/// Enumerations inside oneofs
5560
#[test]
5661
fn oneof_with_enum_custom_debug() {
62+
let of = OneofWithEnumCustomDebug::Enumeration(
63+
BasicEnumeration::TWO as i32,
64+
);
65+
assert_eq!(format!("{:?}", of), "OneofWithEnumCustomDebug {..}");
5766
let msg = MessageWithOneofCustomDebug {
58-
of: Some(OneofWithEnumCustomDebug::Enumeration(
59-
BasicEnumeration::TWO as i32,
60-
)),
67+
of: Some(of),
6168
};
6269
assert_eq!(format!("{:?}", msg), "MessageWithOneofCustomDebug {..}");
6370
}

0 commit comments

Comments
 (0)