2 // aux-build:span-api-tests.rs
3 // aux-build:span-test-macros.rs
7 #![feature(proc_macro_hygiene)]
10 extern crate span_test_macros;
12 extern crate span_api_tests;
14 // FIXME(69775): Investigate `assert_fake_source_file`.
16 use span_api_tests::{reemit, assert_source_file, macro_stringify};
18 macro_rules! say_hello {
19 ($macname:ident) => ( $macname! { "Hello, world!" })
22 assert_source_file! { "Hello, world!" }
24 say_hello! { assert_source_file }
27 assert_source_file! { "Hello, world!" }
30 say_hello_extern! { assert_source_file }
33 assert_source_file! { "Hello, world!" }
37 let s = macro_stringify!(Hello, world!);
38 assert_eq!(s, "Hello, world!");
39 assert_eq!(macro_stringify!(Hello, world!), "Hello, world!");
40 assert_eq!(reemit_legacy!(macro_stringify!(Hello, world!)), "Hello, world!");
41 reemit_legacy!(assert_eq!(macro_stringify!(Hello, world!), "Hello, world!"));
42 // reemit change the span to be that of the call site
44 reemit!(macro_stringify!(Hello, world!)),
45 "reemit!(macro_stringify!(Hello, world!))"
47 let r = "reemit!(assert_eq!(macro_stringify!(Hello, world!), r));";
48 reemit!(assert_eq!(macro_stringify!(Hello, world!), r));
50 assert_eq!(macro_stringify!(
53 ), "Hello,\n world!");
55 assert_eq!(macro_stringify!(Hello, /*world */ !), "Hello, /*world */ !");
56 assert_eq!(macro_stringify!(
60 ), "Hello,\n // comment\n world!");
62 assert_eq!(say_hello! { macro_stringify }, "\"Hello, world!\"");
63 assert_eq!(say_hello_extern! { macro_stringify }, "\"Hello, world!\"");