提交 ff9995e0 编写于 作者: J John Clements

added test cases for closure arg hygiene

上级 63fb7c6f
......@@ -1387,6 +1387,28 @@ fn z() {match 8 {x => bad_macro!(x)}}",
0)
}
// closure arg hygiene
// expands to fn f(){(|x_1 : int| {(x_2 + x_1)})(3);}
#[test] fn closure_arg_hygiene(){
run_renaming_test(
&("macro_rules! inject_x (()=>(x))
fn f(){(|x : int| {(inject_x!() + x)})(3);}",
vec!(vec!(1)),
true),
0)
}
// closure arg hygiene (ExprProc)
// expands to fn f(){(proc(x_1 : int) {(x_2 + x_1)})(3);}
#[test] fn closure_arg_hygiene_2(){
run_renaming_test(
&("macro_rules! inject_x (()=>(x))
fn f(){ (proc(x : int){(inject_x!() + x)})(3); }",
vec!(vec!(1)),
true),
0)
}
// run one of the renaming tests
fn run_renaming_test(t: &RenamingTest, test_idx: uint) {
let invalid_name = token::special_idents::invalid.name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册