Skip to content

Commit 6c6d053

Browse files
committed
renaming test cases
1 parent 2f6498f commit 6c6d053

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
@@ -1452,10 +1452,6 @@ mod test {
14521452
pprust::print_mod(s, &crate.module, crate.attrs);
14531453
}
14541454
1455-
// "fn a() -> int { let b = 13; let c = b; b+c }" --> b & c should get new names, in the expr too.
1456-
// "macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}" --> one should
1457-
// be renamed, one should not.
1458-
14591455
fn expand_and_resolve_and_pretty_print (crate_str : @str) -> ~str {
14601456
let resolver = new_ident_resolver();
14611457
let resolver_fold = fun_to_ident_folder(resolver);
@@ -1469,10 +1465,20 @@ mod test {
14691465

14701466
#[test]
14711467
fn automatic_renaming () {
1468+
// "fn a() -> int { let b = 13; let c = b; b+c }"
1469+
// --> b & c should get new names, in the expr too.
1470+
// "macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}"
1471+
// --> one should be renamed, one should not.
1472+
14721473
let teststrs =
1473-
~[@"fn a() -> int { let b = 13; let c = b; b+c }",
1474-
@"macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}"];
1474+
~[// b & c should get new names throughout, in the expr too:
1475+
@"fn a() -> int { let b = 13; let c = b; b+c }",
1476+
// the use of b before the + should be renamed, the other one not:
1477+
@"macro_rules! f (($x:ident) => ($x + b)) fn a() -> int { let b = 13; f!(b)}",
1478+
// the b before the plus should not be renamed (requires marks)
1479+
@"macro_rules! f (($x:ident) => ({let b=9; ($x + b)})) fn a() -> int { f!(b)}"];
14751480
for s in teststrs.iter() {
1481+
// we need regexps to test these!
14761482
std::io::println(expand_and_resolve_and_pretty_print(*s));
14771483
}
14781484
}

0 commit comments

Comments
 (0)