#[macro_export]
macro_rules! rustc_link_arg {
(to: $stream:expr, $($flag:expr),+ $(,)?) => {
$($crate::pair!(to: $stream, "rustc-link-arg", "{}", $flag);)+
};
($($flag:expr),+ $(,)?) => {
$crate::rustc_link_arg!(to: std::io::stdout(), $($flag),+);
};
}
#[cfg(test)]
mod tests {
#[test]
fn single() {
insta::assert_display_snapshot!(
crate::capture_output(|output| {
crate::rustc_link_arg!(
to: output,
"ARG"
);
}),
@"cargo:rustc-link-arg=ARG
"
);
}
#[test]
fn multiple() {
insta::assert_display_snapshot!(
crate::capture_output(|output| {
crate::rustc_link_arg!(
to: output,
"ARG1",
"ARG2"
);
}),
@r###"
cargo:rustc-link-arg=ARG1
cargo:rustc-link-arg=ARG2
"###
);
}
}