Skip to content

Commit cd773ec

Browse files
tests: Add comment for assert_eq_fmt
1 parent fd7c867 commit cd773ec

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/tests.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ macro_rules! c_fmt {
3939
}};
4040
}
4141

42+
/// Assert that `rust_fmt` produces the same output as C's `asprintf`,
43+
/// and that both match the `expected` literal.
44+
///
45+
/// This takes a format literal, followed by optional printf arguments,
46+
/// followed by `=>` and then the `expected` output.
47+
///
48+
/// Example usage:
49+
///
50+
/// ```
51+
/// assert_eq_fmt!(c"%d %d", 1, 2 => "1 2");
52+
/// ```
4253
macro_rules! assert_eq_fmt {
4354
($format:literal $(, $p:expr)* => $expected:literal) => {
4455
let (bytes_written, s) = c_fmt!($format $(, $p)*);

0 commit comments

Comments
 (0)