Skip to content

Commit 2a50440

Browse files
committed
tests: add additional tests that reflect kernel use cases more
Add some examples that pin-init test suites do not catch when doing feature developments. Signed-off-by: Gary Guo <gary@garyguo.net>
1 parent fde497f commit 2a50440

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

tests/cfgs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@ impl Struct {
2020
}
2121

2222
struct Field {}
23+
24+
#[pin_data]
25+
pub struct Struct2 {
26+
// Test for cases where the type is not even defined when cfg is not satisfied.
27+
#[cfg(any())]
28+
non_exist: NonExistentType,
29+
}

tests/unsized.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use pin_init::*;
2+
3+
use std::sync::atomic::AtomicU32;
4+
5+
// Test that `?Sized` types can work as expected.
6+
// If macro expansion is not careful it may types into positions that required they're typed.
7+
#[pin_data]
8+
#[repr(C)]
9+
struct ArcInner<T: ?Sized> {
10+
refcount: AtomicU32,
11+
data: T,
12+
}

0 commit comments

Comments
 (0)