From 19e1d834ffad4c5023a44f894d570054913e31e8 Mon Sep 17 00:00:00 2001 From: John Clements Date: Tue, 24 Jun 2014 16:33:44 -0700 Subject: [PATCH] enrich and rename crate_idents test case --- src/libsyntax/ext/expand.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index a33e6e5e923..bf68538d656 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1406,13 +1406,19 @@ foo_module!() strs_to_idents(vec!("a","c","b","d"))); } + // test the list of identifier patterns gathered by the visitor. Note that + // 'None' is listed as an identifier pattern because we don't yet know that + // it's the name of a 0-ary variant, and that 'i' appears twice in succession. #[test] - fn pat_idents_2(){ - let the_crate = string_to_crate("fn main (a : int) -> int {|b| {a + b} }".to_string()); - let mut pat_idents = new_name_finder(Vec::new()); - pat_idents.visit_mod(&the_crate.module, the_crate.span, ast::CRATE_NODE_ID, ()); - assert_eq!(pat_idents.ident_accumulator, - strs_to_idents(vec!("a","b"))); + fn crate_idents(){ + let the_crate = string_to_crate("fn main (a : int) -> int {|b| { + match 34 {None => 3, Some(i) | i => j, Foo{k:z,l:y} => \"banana\"}} }".to_string()); + let mut idents = new_name_finder(Vec::new()); + //visit::walk_crate(&mut idents, &the_crate, ()); + idents.visit_mod(&the_crate.module, the_crate.span, ast::CRATE_NODE_ID, ()); + assert_eq!(idents.ident_accumulator, + strs_to_idents(vec!("a","b","None","i","i","z","y"))); } + }