3 // aux-build:span-api-tests.rs
4 // aux-build:span-test-macros.rs
7 extern crate span_test_macros;
9 extern crate span_api_tests;
11 // FIXME(69775): Investigate `assert_fake_source_file`.
13 use span_api_tests::{reemit, assert_source_file, macro_stringify};
15 macro_rules! say_hello {
16 ($macname:ident) => ( $macname! { "Hello, world!" })
19 assert_source_file! { "Hello, world!" }
21 say_hello! { assert_source_file }
24 assert_source_file! { "Hello, world!" }
27 say_hello_extern! { assert_source_file }
30 assert_source_file! { "Hello, world!" }
34 let s = macro_stringify!(Hello, world!);
35 assert_eq!(s, "Hello, world!");
36 assert_eq!(macro_stringify!(Hello, world!), "Hello, world!");
37 assert_eq!(reemit_legacy!(macro_stringify!(Hello, world!)), "Hello, world!");
38 reemit_legacy!(assert_eq!(macro_stringify!(Hello, world!), "Hello, world!"));
39 // reemit change the span to be that of the call site
41 reemit!(macro_stringify!(Hello, world!)),
42 "reemit!(macro_stringify!(Hello, world!))"
44 let r = "reemit!(assert_eq!(macro_stringify!(Hello, world!), r));";
45 reemit!(assert_eq!(macro_stringify!(Hello, world!), r));
47 assert_eq!(macro_stringify!(
50 ), "Hello,\n world!");
52 assert_eq!(macro_stringify!(Hello, /*world */ !), "Hello, /*world */ !");
53 assert_eq!(macro_stringify!(
57 ), "Hello,\n // comment\n world!");
59 assert_eq!(say_hello! { macro_stringify }, "\"Hello, world!\"");
60 assert_eq!(say_hello_extern! { macro_stringify }, "\"Hello, world!\"");