Fix symbols::tests::test_symbols
---- symbols::tests::test_symbols stdout ---- thread 'symbols::tests::test_symbols' panicked at library/proc_macro/src/bridge/client.rs:311:17: procedural macro API is used outside of a procedural macro
This commit is contained in:
parent
ac4fa3f245
commit
c1552dfddd
@ -257,6 +257,14 @@ fn symbols_with_errors(input: TokenStream) -> (TokenStream, Vec<syn::Error>) {
|
||||
Value::SameAsName | Value::String(_) | Value::Unsupported(_) => continue,
|
||||
};
|
||||
|
||||
if !proc_macro::is_available() {
|
||||
errors.error(
|
||||
Span::call_site(),
|
||||
"proc_macro::tracked_env is not available in unit test".to_owned(),
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
let value = match proc_macro::tracked_env::var(env_var.value()) {
|
||||
Ok(value) => value,
|
||||
Err(err) => {
|
||||
|
@ -27,7 +27,7 @@ fn test_symbols() {
|
||||
|
||||
let body_tokens = m.mac.tokens.clone();
|
||||
|
||||
test_symbols_macro(body_tokens, &[]);
|
||||
test_symbols_macro(body_tokens, &["proc_macro::tracked_env is not available in unit test"]);
|
||||
}
|
||||
|
||||
fn test_symbols_macro(input: TokenStream, expected_errors: &[&str]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user