diff options
| author | John Clements <clements@racket-lang.org> | 2014-06-24 16:33:44 -0700 |
|---|---|---|
| committer | John Clements <clements@racket-lang.org> | 2014-06-25 14:16:12 -0700 |
| commit | 19e1d834ffad4c5023a44f894d570054913e31e8 (patch) | |
| tree | 787b332601954e569f25dbf4cc1a53b6219f9d53 /src/libsyntax | |
| parent | 9215d7e5b764c173ef8b2fecda913d39291e378b (diff) | |
| download | rust-19e1d834ffad4c5023a44f894d570054913e31e8.tar.gz rust-19e1d834ffad4c5023a44f894d570054913e31e8.zip | |
enrich and rename crate_idents test case
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 18 |
1 files 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"))); } + } |
