Skip to content

Commit 24e349c

Browse files
committed
test(boxed_field): Confirm Foo::bar is boxed
1 parent 7968f90 commit 24e349c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

tests/src/boxed_field.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include!(concat!(env!("OUT_DIR"), "/boxed_field.rs"));
2+
3+
#[test]
4+
/// Confirm `Foo::bar` is boxed by creating an instance
5+
fn test_bar_is_boxed() {
6+
use alloc::boxed::Box;
7+
let _ = Foo {
8+
bar: Some(Box::new(Bar {})),
9+
};
10+
}

tests/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ mod submessage_without_package;
5656
#[cfg(test)]
5757
mod type_names;
5858

59+
#[cfg(test)]
60+
mod boxed_field;
61+
5962
mod test_enum_named_option_value {
6063
include!(concat!(env!("OUT_DIR"), "/myenum.optionn.rs"));
6164
}
@@ -140,10 +143,6 @@ pub mod invalid {
140143
}
141144
}
142145

143-
pub mod boxed_field {
144-
include!(concat!(env!("OUT_DIR"), "/boxed_field.rs"));
145-
}
146-
147146
pub mod default_string_escape {
148147
include!(concat!(env!("OUT_DIR"), "/default_string_escape.rs"));
149148
}

0 commit comments

Comments
 (0)