3 // aux-build:span-api-tests.rs
4 // aux-build:span-test-macros.rs
5 // compile-flags: -Ztranslate-remapped-path-to-local-path=yes
8 extern crate span_test_macros;
10 extern crate span_api_tests;
12 // FIXME(69775): Investigate `assert_fake_source_file`.
14 use span_api_tests::{reemit, assert_source_file, macro_stringify};
16 macro_rules! say_hello {
17 ($macname:ident) => ( $macname! { "Hello, world!" })
20 assert_source_file! { "Hello, world!" }
22 say_hello! { assert_source_file }
25 assert_source_file! { "Hello, world!" }
28 say_hello_extern! { assert_source_file }
31 assert_source_file! { "Hello, world!" }
35 let s = macro_stringify!(Hello, world!);
36 assert_eq!(s, "Hello, world!");
37 assert_eq!(macro_stringify!(Hello, world!), "Hello, world!");
38 assert_eq!(reemit_legacy!(macro_stringify!(Hello, world!)), "Hello, world!");
39 reemit_legacy!(assert_eq!(macro_stringify!(Hello, world!), "Hello, world!"));
40 // reemit change the span to be that of the call site
42 reemit!(macro_stringify!(Hello, world!)),
43 "reemit!(macro_stringify!(Hello, world!))"
45 let r = "reemit!(assert_eq!(macro_stringify!(Hello, world!), r))";
46 reemit!(assert_eq!(macro_stringify!(Hello, world!), r));
48 assert_eq!(macro_stringify!(
51 ), "Hello,\n world!");
53 assert_eq!(macro_stringify!(Hello, /*world */ !), "Hello, /*world */ !");
54 assert_eq!(macro_stringify!(
58 ), "Hello,\n // comment\n world!");
60 assert_eq!(say_hello! { macro_stringify }, "\"Hello, world!\"");
61 assert_eq!(say_hello_extern! { macro_stringify }, "\"Hello, world!\"");