cargo_emit/
rustc_link_arg_bin.rs1#[macro_export]
30macro_rules! rustc_link_arg_bin {
31 (to: $stream:expr, $bin:expr => $flags:expr $(,)?) => {
32 $crate::pair!(to: $stream, "rustc-link-arg-bin", "{}={}", $bin, $flags);
33 };
34 (to: $stream:expr, $($bin:expr=> $flags:expr),+ $(,)?) => { {
35 $($crate::rustc_link_arg_bin!(to: $stream, $bin => $flags);)+
36 } };
37 ($bin:expr => $flags:expr $(,)?) => {
38 $crate::rustc_link_arg_bin!(to: std::io::stdout(), $bin => $flags);
39 };
40 ($($bin:expr=> $flags:expr),+ $(,)?) => { {
41 $crate::rustc_link_arg_bin!(to: std::io::stdout(), $($bin=> $flags),+);
42 } };
43}
44
45#[cfg(test)]
46mod tests {
47 #[test]
48 fn single() {
49 insta::assert_display_snapshot!(
50 crate::capture_output(|output| {
51 crate::rustc_link_arg_bin!(
52 to: output,
53 "BIN" => "FLAGS"
54 );
55 }),
56 @"cargo:rustc-link-arg-bin=BIN=FLAGS
57 "
58 );
59 }
60
61 #[test]
62 fn multiple() {
63 insta::assert_display_snapshot!(
64 crate::capture_output(|output| {
65 crate::rustc_link_arg_bin!(
66 to: output,
67 "BIN1" => "FLAGS1",
68 "BIN2" => "FLAGS2",
69 );
70 }),
71 @r###"
72 cargo:rustc-link-arg-bin=BIN1=FLAGS1
73 cargo:rustc-link-arg-bin=BIN2=FLAGS2
74 "###
75 );
76 }
77}