diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-19 18:09:06 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-19 18:14:17 -0800 |
| commit | 991db34b5bb9f2744109375c3d6345c8a21482d1 (patch) | |
| tree | 3b1c41d4f58214d3b362be908e0d97c85660d493 /src/comp | |
| parent | 052340980b2352f5c2f3f3d9a806827073a2a944 (diff) | |
| download | rust-991db34b5bb9f2744109375c3d6345c8a21482d1.tar.gz rust-991db34b5bb9f2744109375c3d6345c8a21482d1.zip | |
rustc: Fix fun_to_str
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 2b62157593b..dc43c53ff30 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -98,10 +98,24 @@ fn fun_to_str(decl: ast::fn_decl, name: ast::ident, let buffer = io::mk_mem_buffer(); let s = rust_printer(io::mem_buffer_writer(buffer)); print_fn(s, decl, name, params); + end(s); // Close the head box + end(s); // Close the outer box eof(s.s); io::mem_buffer_str(buffer) } +#[test] +fn test_fun_to_str() { + let decl: ast::fn_decl = { + inputs: [], + output: @ast_util::respan(ast_util::dummy_sp(), ast::ty_nil), + purity: ast::impure_fn, + cf: ast::return_val, + constraints: [] + }; + assert fun_to_str(decl, "a", []) == "fn a()"; +} + fn block_to_str(blk: ast::blk) -> str { let buffer = io::mk_mem_buffer(); let s = rust_printer(io::mem_buffer_writer(buffer)); |
