Skip to content

Commit 93fbd6f

Browse files
committed
Add struct enum variant tests
1 parent d568a31 commit 93fbd6f

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

tests/skip/debug.rs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use derive_where::derive_where;
33
use crate::util::{AssertDebug, Wrapper};
44

55
#[test]
6-
fn all() {
6+
fn struct_all() {
77
#[derive_where(Debug)]
88
#[derive_where(skip_inner)]
99
struct Test<T> {
@@ -18,7 +18,7 @@ fn all() {
1818
}
1919

2020
#[test]
21-
fn partial() {
21+
fn struct_partial() {
2222
#[derive_where(Debug)]
2323
struct Test<T> {
2424
#[derive_where(skip)]
@@ -35,3 +35,39 @@ fn partial() {
3535

3636
assert_eq!(format!("{:?}", test_1), "Test { b: 42, .. }");
3737
}
38+
39+
#[test]
40+
fn variant_all() {
41+
#[derive_where(Debug)]
42+
enum Test<T> {
43+
#[derive_where(skip_inner)]
44+
A { a: Wrapper<T> },
45+
}
46+
47+
let test_1 = Test::A { a: 42.into() };
48+
49+
let _ = AssertDebug(&test_1);
50+
51+
assert_eq!(format!("{:?}", test_1), "A { .. }");
52+
}
53+
54+
#[test]
55+
fn variant_partial() {
56+
#[derive_where(Debug)]
57+
enum Test<T> {
58+
A {
59+
#[derive_where(skip)]
60+
a: Wrapper<T>,
61+
b: Wrapper<T>,
62+
},
63+
}
64+
65+
let test_1 = Test::A {
66+
a: 42.into(),
67+
b: 42.into(),
68+
};
69+
70+
let _ = AssertDebug(&test_1);
71+
72+
assert_eq!(format!("{:?}", test_1), "A { b: 42, .. }");
73+
}

0 commit comments

Comments
 (0)