Skip to content

Commit bf08249

Browse files
authored
Merge pull request BurntSushi#152 from emallson/master
Added attr support to quickcheck! macro.
2 parents 570f6a8 + f0e83b1 commit bf08249

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ macro_rules! quickcheck {
4646
(@as_items $($i:item)*) => ($($i)*);
4747
{
4848
$(
49+
$(#[$m:meta])*
4950
fn $fn_name:ident($($arg_name:ident : $arg_ty:ty),*) -> $ret:ty {
5051
$($code:tt)*
5152
}
@@ -55,6 +56,7 @@ macro_rules! quickcheck {
5556
@as_items
5657
$(
5758
#[test]
59+
$(#[$m])*
5860
fn $fn_name() {
5961
fn prop($($arg_name: $arg_ty),*) -> $ret {
6062
$($code)*

src/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ quickcheck! {
3131
let revrev: Vec<_> = rev.into_iter().rev().collect();
3232
xs == revrev
3333
}
34+
35+
#[should_panic]
36+
fn prop_macro_panic(_x: u32) -> bool {
37+
assert!(false);
38+
false
39+
}
3440
}
3541

3642
#[test]

0 commit comments

Comments
 (0)