Skip to content

Commit

Permalink
Count total number of generated expressions in permutations test
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 29, 2024
1 parent 3f2acdc commit e749a20
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ fn test_permutations() -> ExitCode {
});
}

let mut count = 0;
let mut status = ExitCode::SUCCESS;
macro_rules! fail {
($($message:tt)*) => {{
Expand All @@ -1189,12 +1190,14 @@ fn test_permutations() -> ExitCode {
}};
}
let mut assert = |expr: Expr| {
count += 1;
let tokens = expr.to_token_stream();
if syn::parse2::<Expr>(tokens.clone()).is_err() {
fail!("failed to parse: {}", tokens);
}
};

iter(2, &mut assert);
assert_eq!(count, 134599);
status
}

0 comments on commit e749a20

Please sign in to comment.