Skip to content

Commit 7ecc460

Browse files
committed
Add test for extra field
Signed-off-by: Christian Poveda <[email protected]>
1 parent 0cd5996 commit 7ecc460

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use cyclonedx_bom_macros::versioned;
2+
3+
#[versioned("1.0", "2.0")]
4+
mod base {
5+
pub struct Foo {
6+
#[versioned("2.0")]
7+
// This field only exists in version 2.0.
8+
pub bar: u32,
9+
}
10+
}
11+
12+
fn main() {
13+
// Version 1.0 does not have the `bar` field but 2.0 does.
14+
let _old_foo = v1_0::Foo {};
15+
let _new_foo = v2_0::Foo { bar: 0 };
16+
}

0 commit comments

Comments
 (0)