k9
k9 copied to clipboard
Trailing comma in multiline macros
assert_err_matches_regex!(
conn.query_raw("SELECT 1").await,
"time out"
);
works, but
assert_err_matches_regex!(
conn.query_raw("SELECT 1").await,
"time out",
);
doesn't
Found a Similar issue: https://github.com/gluon-lang/gluon/issues/770
And it's commit to solve the issue: https://github.com/Marwes/gluon/commit/bb41fa15765f7825f7f7c1e64388010cd4610950
Using this worked for me but it required me to define multiple patterns (One with a trailing comma and one without) inside assertion macros which kinda go against the DRY principle. Let me know if you have a better approach for this. :D
@TheWebDevel would something like $( , )?
work?
i remember i solved before with a separate macro definition, but yeah... this whole crate is already not DRY, so it'd be nice to not 2x every macro definition 🙂
$( , )
This is what worked for me but I had to define respective pattern matching to handle with and without trailing comma scenarios.