43 lines
598 B
Plaintext
43 lines
598 B
Plaintext
pub module attribute_test;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Debuggable
|
|
{
|
|
i32 value;
|
|
}
|
|
|
|
pub void test_derive_attribute()
|
|
{
|
|
let d = Debuggable {
|
|
value: 42,
|
|
};
|
|
assert_eq!(d.value, 42);
|
|
}
|
|
|
|
#[allow(unused_variables)]
|
|
pub void test_allow_attribute()
|
|
{
|
|
let x = 42;
|
|
let y = "unused";
|
|
assert_eq!(x, 42);
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
pub struct Tagged
|
|
{
|
|
i32 id;
|
|
}
|
|
|
|
pub void test_attribute_with_args()
|
|
{
|
|
Tagged t = Tagged { id: 1 };
|
|
assert_eq!(t.id, 1);
|
|
}
|
|
|
|
pub void run_tests()
|
|
{
|
|
test_derive_attribute();
|
|
test_allow_attribute();
|
|
test_attribute_with_args();
|
|
}
|