Skip to content

Commit 19e1d83

Browse files
committed
enrich and rename crate_idents test case
1 parent 9215d7e commit 19e1d83

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,13 +1406,19 @@ foo_module!()
14061406
strs_to_idents(vec!("a","c","b","d")));
14071407
}
14081408

1409+
// test the list of identifier patterns gathered by the visitor. Note that
1410+
// 'None' is listed as an identifier pattern because we don't yet know that
1411+
// it's the name of a 0-ary variant, and that 'i' appears twice in succession.
14091412
#[test]
1410-
fn pat_idents_2(){
1411-
let the_crate = string_to_crate("fn main (a : int) -> int {|b| {a + b} }".to_string());
1412-
let mut pat_idents = new_name_finder(Vec::new());
1413-
pat_idents.visit_mod(&the_crate.module, the_crate.span, ast::CRATE_NODE_ID, ());
1414-
assert_eq!(pat_idents.ident_accumulator,
1415-
strs_to_idents(vec!("a","b")));
1413+
fn crate_idents(){
1414+
let the_crate = string_to_crate("fn main (a : int) -> int {|b| {
1415+
match 34 {None => 3, Some(i) | i => j, Foo{k:z,l:y} => \"banana\"}} }".to_string());
1416+
let mut idents = new_name_finder(Vec::new());
1417+
//visit::walk_crate(&mut idents, &the_crate, ());
1418+
idents.visit_mod(&the_crate.module, the_crate.span, ast::CRATE_NODE_ID, ());
1419+
assert_eq!(idents.ident_accumulator,
1420+
strs_to_idents(vec!("a","b","None","i","i","z","y")));
14161421
}
14171422

1423+
14181424
}

0 commit comments

Comments
 (0)