Set up libsyntax globals for tests
diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs
index e427800..6c2d74c 100644
--- a/tests/test_precedence.rs
+++ b/tests/test_precedence.rs
@@ -162,7 +162,7 @@
let mut passed = 0;
let mut failed = 0;
- for expr in exprs {
+ syntax::with_globals(|| for expr in exprs {
let raw = quote!(#expr).to_string();
let libsyntax_ast = if let Some(e) = libsyntax_parse_and_rewrite(&raw) {
@@ -191,7 +191,7 @@
failed += 1;
errorf!("\nFAIL\n{:?}\n!=\n{:?}\n", syn_ast, libsyntax_ast);
}
- }
+ });
(passed, failed)
}
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index ce829d0..3313acb 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -146,5 +146,7 @@
fn libsyntax_parse(content: String, sess: &ParseSess) -> PResult<ast::Crate> {
let name = FileName::Custom("test_round_trip".to_string());
- parse::parse_crate_from_source_str(name, content, sess).map(common::respan::respan_crate)
+ syntax::with_globals(|| {
+ parse::parse_crate_from_source_str(name, content, sess).map(common::respan::respan_crate)
+ })
}