Skip to content

Commit

Permalink
Expand test_macros_evaluate_args_once to test more (#1287)
Browse files Browse the repository at this point in the history
In particular, add tests for `transmute_mut!` and `try_transmute!`.
  • Loading branch information
joshlf committed May 17, 2024
1 parent 146c73b commit 73888d9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5729,6 +5729,21 @@ mod tests {
&0usize
});
assert_eq!(ctr, 1);

let mut ctr: usize = 0;
let _: &mut usize = transmute_mut!({
ctr += 1;
&mut ctr
});
assert_eq!(ctr, 1);

let mut ctr = 0;
let _: usize = try_transmute!({
ctr += 1;
0usize
})
.unwrap();
assert_eq!(ctr, 1);
}

#[test]
Expand Down

0 comments on commit 73888d9

Please sign in to comment.