Skip to content

Commit f62c5cc

Browse files
committed
Update tests to API changes
1 parent e3fe4cf commit f62c5cc

File tree

11 files changed

+46
-46
lines changed

11 files changed

+46
-46
lines changed

src/librustc/session/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,7 @@ mod tests {
27392739
// When the user supplies --test we should implicitly supply --cfg test
27402740
#[test]
27412741
fn test_switch_implies_cfg_test() {
2742-
syntax::with_globals(|| {
2742+
syntax::with_globals(&[], || {
27432743
let matches = &match optgroups().parse(&["--test".to_string()]) {
27442744
Ok(m) => m,
27452745
Err(f) => panic!("test_switch_implies_cfg_test: {}", f),
@@ -2757,7 +2757,7 @@ mod tests {
27572757
#[test]
27582758
fn test_switch_implies_cfg_test_unless_cfg_test() {
27592759
use syntax::symbol::sym;
2760-
syntax::with_globals(|| {
2760+
syntax::with_globals(&[], || {
27612761
let matches = &match optgroups().parse(&["--test".to_string(),
27622762
"--cfg=test".to_string()]) {
27632763
Ok(m) => m,
@@ -2775,15 +2775,15 @@ mod tests {
27752775

27762776
#[test]
27772777
fn test_can_print_warnings() {
2778-
syntax::with_globals(|| {
2778+
syntax::with_globals(&[], || {
27792779
let matches = optgroups().parse(&["-Awarnings".to_string()]).unwrap();
27802780
let registry = errors::registry::Registry::new(&[]);
27812781
let (sessopts, _) = build_session_options_and_crate_config(&matches);
27822782
let sess = build_session(sessopts, None, registry);
27832783
assert!(!sess.diagnostic().flags.can_emit_warnings);
27842784
});
27852785

2786-
syntax::with_globals(|| {
2786+
syntax::with_globals(&[], || {
27872787
let matches = optgroups()
27882788
.parse(&["-Awarnings".to_string(), "-Dwarnings".to_string()])
27892789
.unwrap();
@@ -2793,7 +2793,7 @@ mod tests {
27932793
assert!(sess.diagnostic().flags.can_emit_warnings);
27942794
});
27952795

2796-
syntax::with_globals(|| {
2796+
syntax::with_globals(&[], || {
27972797
let matches = optgroups().parse(&["-Adead_code".to_string()]).unwrap();
27982798
let registry = errors::registry::Registry::new(&[]);
27992799
let (sessopts, _) = build_session_options_and_crate_config(&matches);

src/libsyntax/mut_visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ mod tests {
13431343

13441344
// make sure idents get transformed everywhere
13451345
#[test] fn ident_transformation () {
1346-
with_globals(|| {
1346+
with_globals(&[], || {
13471347
let mut zz_visitor = ToZzIdentMutVisitor;
13481348
let mut krate = string_to_crate(
13491349
"#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string());
@@ -1358,7 +1358,7 @@ mod tests {
13581358

13591359
// even inside macro defs....
13601360
#[test] fn ident_transformation_in_defs () {
1361-
with_globals(|| {
1361+
with_globals(&[], || {
13621362
let mut zz_visitor = ToZzIdentMutVisitor;
13631363
let mut krate = string_to_crate(
13641364
"macro_rules! a {(b $c:expr $(d $e:token)f+ => \

src/libsyntax/parse/lexer/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ mod tests {
16011601

16021602
#[test]
16031603
fn t1() {
1604-
with_globals(|| {
1604+
with_globals(&[], || {
16051605
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16061606
let sh = mk_sess(sm.clone());
16071607
let mut string_reader = setup(&sm,
@@ -1649,7 +1649,7 @@ mod tests {
16491649

16501650
#[test]
16511651
fn doublecolonparsing() {
1652-
with_globals(|| {
1652+
with_globals(&[], || {
16531653
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16541654
let sh = mk_sess(sm.clone());
16551655
check_tokenization(setup(&sm, &sh, "a b".to_string()),
@@ -1659,7 +1659,7 @@ mod tests {
16591659

16601660
#[test]
16611661
fn dcparsing_2() {
1662-
with_globals(|| {
1662+
with_globals(&[], || {
16631663
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16641664
let sh = mk_sess(sm.clone());
16651665
check_tokenization(setup(&sm, &sh, "a::b".to_string()),
@@ -1669,7 +1669,7 @@ mod tests {
16691669

16701670
#[test]
16711671
fn dcparsing_3() {
1672-
with_globals(|| {
1672+
with_globals(&[], || {
16731673
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16741674
let sh = mk_sess(sm.clone());
16751675
check_tokenization(setup(&sm, &sh, "a ::b".to_string()),
@@ -1679,7 +1679,7 @@ mod tests {
16791679

16801680
#[test]
16811681
fn dcparsing_4() {
1682-
with_globals(|| {
1682+
with_globals(&[], || {
16831683
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16841684
let sh = mk_sess(sm.clone());
16851685
check_tokenization(setup(&sm, &sh, "a:: b".to_string()),
@@ -1689,7 +1689,7 @@ mod tests {
16891689

16901690
#[test]
16911691
fn character_a() {
1692-
with_globals(|| {
1692+
with_globals(&[], || {
16931693
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
16941694
let sh = mk_sess(sm.clone());
16951695
assert_eq!(setup(&sm, &sh, "'a'".to_string()).next_token().tok,
@@ -1699,7 +1699,7 @@ mod tests {
16991699

17001700
#[test]
17011701
fn character_space() {
1702-
with_globals(|| {
1702+
with_globals(&[], || {
17031703
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17041704
let sh = mk_sess(sm.clone());
17051705
assert_eq!(setup(&sm, &sh, "' '".to_string()).next_token().tok,
@@ -1709,7 +1709,7 @@ mod tests {
17091709

17101710
#[test]
17111711
fn character_escaped() {
1712-
with_globals(|| {
1712+
with_globals(&[], || {
17131713
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17141714
let sh = mk_sess(sm.clone());
17151715
assert_eq!(setup(&sm, &sh, "'\\n'".to_string()).next_token().tok,
@@ -1719,7 +1719,7 @@ mod tests {
17191719

17201720
#[test]
17211721
fn lifetime_name() {
1722-
with_globals(|| {
1722+
with_globals(&[], || {
17231723
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17241724
let sh = mk_sess(sm.clone());
17251725
assert_eq!(setup(&sm, &sh, "'abc".to_string()).next_token().tok,
@@ -1729,7 +1729,7 @@ mod tests {
17291729

17301730
#[test]
17311731
fn raw_string() {
1732-
with_globals(|| {
1732+
with_globals(&[], || {
17331733
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17341734
let sh = mk_sess(sm.clone());
17351735
assert_eq!(setup(&sm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
@@ -1741,7 +1741,7 @@ mod tests {
17411741

17421742
#[test]
17431743
fn literal_suffixes() {
1744-
with_globals(|| {
1744+
with_globals(&[], || {
17451745
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17461746
let sh = mk_sess(sm.clone());
17471747
macro_rules! test {
@@ -1787,7 +1787,7 @@ mod tests {
17871787

17881788
#[test]
17891789
fn nested_block_comments() {
1790-
with_globals(|| {
1790+
with_globals(&[], || {
17911791
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
17921792
let sh = mk_sess(sm.clone());
17931793
let mut lexer = setup(&sm, &sh, "/* /* */ */'a'".to_string());
@@ -1802,7 +1802,7 @@ mod tests {
18021802

18031803
#[test]
18041804
fn crlf_comments() {
1805-
with_globals(|| {
1805+
with_globals(&[], || {
18061806
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
18071807
let sh = mk_sess(sm.clone());
18081808
let mut lexer = setup(&sm, &sh, "// test\r\n/// test\r\n".to_string());

src/libsyntax/parse/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,15 +382,15 @@ mod tests {
382382

383383
#[should_panic]
384384
#[test] fn bad_path_expr_1() {
385-
with_globals(|| {
385+
with_globals(&[], || {
386386
string_to_expr("::abc::def::return".to_string());
387387
})
388388
}
389389

390390
// check the token-tree-ization of macros
391391
#[test]
392392
fn string_to_tts_macro () {
393-
with_globals(|| {
393+
with_globals(&[], || {
394394
use crate::symbol::sym;
395395

396396
let tts: Vec<_> =
@@ -447,7 +447,7 @@ mod tests {
447447

448448
#[test]
449449
fn string_to_tts_1() {
450-
with_globals(|| {
450+
with_globals(&[], || {
451451
let tts = string_to_stream("fn a (b : i32) { b; }".to_string());
452452

453453
let expected = TokenStream::new(vec![
@@ -480,7 +480,7 @@ mod tests {
480480
}
481481

482482
#[test] fn parse_use() {
483-
with_globals(|| {
483+
with_globals(&[], || {
484484
let use_s = "use foo::bar::baz;";
485485
let vitem = string_to_item(use_s.to_string()).unwrap();
486486
let vitem_s = item_to_string(&vitem);
@@ -494,7 +494,7 @@ mod tests {
494494
}
495495

496496
#[test] fn parse_extern_crate() {
497-
with_globals(|| {
497+
with_globals(&[], || {
498498
let ex_s = "extern crate foo;";
499499
let vitem = string_to_item(ex_s.to_string()).unwrap();
500500
let vitem_s = item_to_string(&vitem);
@@ -531,7 +531,7 @@ mod tests {
531531
}
532532

533533
#[test] fn span_of_self_arg_pat_idents_are_correct() {
534-
with_globals(|| {
534+
with_globals(&[], || {
535535

536536
let srcs = ["impl z { fn a (&self, &myarg: i32) {} }",
537537
"impl z { fn a (&mut self, &myarg: i32) {} }",
@@ -551,15 +551,15 @@ mod tests {
551551
}
552552

553553
#[test] fn parse_exprs () {
554-
with_globals(|| {
554+
with_globals(&[], || {
555555
// just make sure that they parse....
556556
string_to_expr("3 + 4".to_string());
557557
string_to_expr("a::z.froob(b,&(987+3))".to_string());
558558
})
559559
}
560560

561561
#[test] fn attrs_fix_bug () {
562-
with_globals(|| {
562+
with_globals(&[], || {
563563
string_to_item("pub fn mk_file_writer(path: &Path, flags: &[FileFlag])
564564
-> Result<Box<Writer>, String> {
565565
#[cfg(windows)]
@@ -576,7 +576,7 @@ mod tests {
576576
}
577577

578578
#[test] fn crlf_doc_comments() {
579-
with_globals(|| {
579+
with_globals(&[], || {
580580
use crate::symbol::sym;
581581

582582
let sess = ParseSess::new(FilePathMapping::empty());
@@ -613,7 +613,7 @@ mod tests {
613613
new_parser_from_source_str(sess, name, source).parse_expr()
614614
}
615615

616-
with_globals(|| {
616+
with_globals(&[], || {
617617
let sess = ParseSess::new(FilePathMapping::empty());
618618
let expr = parse_expr_from_source_str(PathBuf::from("foo").into(),
619619
"foo!( fn main() { body } )".to_string(), &sess).unwrap();
@@ -637,7 +637,7 @@ mod tests {
637637
// See `recurse_into_file_modules` in the parser.
638638
#[test]
639639
fn out_of_line_mod() {
640-
with_globals(|| {
640+
with_globals(&[], || {
641641
let sess = ParseSess::new(FilePathMapping::empty());
642642
let item = parse_item_from_source_str(
643643
PathBuf::from("foo").into(),

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,7 +3151,7 @@ mod tests {
31513151

31523152
#[test]
31533153
fn test_fun_to_string() {
3154-
with_globals(|| {
3154+
with_globals(&[], || {
31553155
let abba_ident = ast::Ident::from_str("abba");
31563156

31573157
let decl = ast::FnDecl {
@@ -3179,7 +3179,7 @@ mod tests {
31793179

31803180
#[test]
31813181
fn test_variant_to_string() {
3182-
with_globals(|| {
3182+
with_globals(&[], || {
31833183
let ident = ast::Ident::from_str("principal_skinner");
31843184

31853185
let var = source_map::respan(syntax_pos::DUMMY_SP, ast::Variant_ {

src/libsyntax/test_snippet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<T: Write> Write for Shared<T> {
3939
}
4040

4141
fn test_harness(file_text: &str, span_labels: Vec<SpanLabel>, expected_output: &str) {
42-
with_globals(|| {
42+
with_globals(&[], || {
4343
let output = Arc::new(Mutex::new(Vec::new()));
4444

4545
let source_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));

src/libsyntax/tokenstream.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ mod tests {
572572

573573
#[test]
574574
fn test_concat() {
575-
with_globals(|| {
575+
with_globals(&[], || {
576576
let test_res = string_to_ts("foo::bar::baz");
577577
let test_fst = string_to_ts("foo::bar");
578578
let test_snd = string_to_ts("::baz");
@@ -585,7 +585,7 @@ mod tests {
585585

586586
#[test]
587587
fn test_to_from_bijection() {
588-
with_globals(|| {
588+
with_globals(&[], || {
589589
let test_start = string_to_ts("foo::bar(baz)");
590590
let test_end = test_start.trees().collect();
591591
assert_eq!(test_start, test_end)
@@ -594,7 +594,7 @@ mod tests {
594594

595595
#[test]
596596
fn test_eq_0() {
597-
with_globals(|| {
597+
with_globals(&[], || {
598598
let test_res = string_to_ts("foo");
599599
let test_eqs = string_to_ts("foo");
600600
assert_eq!(test_res, test_eqs)
@@ -603,7 +603,7 @@ mod tests {
603603

604604
#[test]
605605
fn test_eq_1() {
606-
with_globals(|| {
606+
with_globals(&[], || {
607607
let test_res = string_to_ts("::bar::baz");
608608
let test_eqs = string_to_ts("::bar::baz");
609609
assert_eq!(test_res, test_eqs)
@@ -612,7 +612,7 @@ mod tests {
612612

613613
#[test]
614614
fn test_eq_3() {
615-
with_globals(|| {
615+
with_globals(&[], || {
616616
let test_res = string_to_ts("");
617617
let test_eqs = string_to_ts("");
618618
assert_eq!(test_res, test_eqs)
@@ -621,7 +621,7 @@ mod tests {
621621

622622
#[test]
623623
fn test_diseq_0() {
624-
with_globals(|| {
624+
with_globals(&[], || {
625625
let test_res = string_to_ts("::bar::baz");
626626
let test_eqs = string_to_ts("bar::baz");
627627
assert_eq!(test_res == test_eqs, false)
@@ -630,7 +630,7 @@ mod tests {
630630

631631
#[test]
632632
fn test_diseq_1() {
633-
with_globals(|| {
633+
with_globals(&[], || {
634634
let test_res = string_to_ts("(bar,baz)");
635635
let test_eqs = string_to_ts("bar,baz");
636636
assert_eq!(test_res == test_eqs, false)
@@ -639,7 +639,7 @@ mod tests {
639639

640640
#[test]
641641
fn test_is_empty() {
642-
with_globals(|| {
642+
with_globals(&[], || {
643643
let test0: TokenStream = Vec::<TokenTree>::new().into_iter().collect();
644644
let test1: TokenStream =
645645
TokenTree::Token(sp(0, 1), Token::Ident(Ident::from_str("a"), false)).into();

src/libsyntax/util/lev_distance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn test_lev_distance() {
102102
#[test]
103103
fn test_find_best_match_for_name() {
104104
use crate::with_globals;
105-
with_globals(|| {
105+
with_globals(&[], || {
106106
let input = vec![Symbol::intern("aaab"), Symbol::intern("aaabc")];
107107
assert_eq!(
108108
find_best_match_for_name(input.iter(), "aaaa", None),

src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn reject_stmt_parse(es: &str) {
105105
}
106106

107107
fn main() {
108-
syntax::with_globals(|| run());
108+
syntax::with_globals(&[], || run());
109109
}
110110

111111
fn run() {

0 commit comments

Comments
 (0)