diff options
| author | klutzy <klutzytheklutzy@gmail.com> | 2014-04-16 14:29:02 +0900 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-13 17:24:08 -0700 |
| commit | ce8c467bd2062edc1410f54c8efafbc5ae245358 (patch) | |
| tree | 83779aab5e765490af2d6fc9768a2de5f4e0bffd /src/compiletest | |
| parent | 96eeda9708605a60635229d45587f79f9a334ded (diff) | |
compiletest: Test `--pretty expanded`
After testing `--pretty normal`, it tries to run `--pretty expanded` and typecheck output. Here we don't check convergence since it really diverges: for every iteration, some extra lines (e.g.`extern crate std`) are inserted. Some tests are `ignore-pretty`-ed since they cause various issues with `--pretty expanded`.
Diffstat (limited to 'src/compiletest')
| -rw-r--r-- | src/compiletest/runtest.rs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 66bebaff014..bd909c8f069 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -157,9 +157,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { let mut round = 0; while round < rounds { logv(config, format!("pretty-printing round {}", round)); - let proc_res = print_source(config, - testfile, - (*srcs.get(round)).clone()); + let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "normal"); if !proc_res.status.success() { fatal_ProcRes(format!("pretty-printing failed in round {}", round), @@ -197,10 +195,27 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { fatal_ProcRes("pretty-printed source does not typecheck".to_owned(), &proc_res); } + // additionally, run `--pretty expanded` and try to build it. + let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded"); + if !proc_res.status.success() { + fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res); + } + + let ProcRes{ stdout: expanded_src, .. } = proc_res; + let proc_res = typecheck_source(config, props, testfile, expanded_src); + if !proc_res.status.success() { + fatal_ProcRes(format!("pretty-printed source (expanded) does not typecheck"), &proc_res); + } + return; - fn print_source(config: &Config, testfile: &Path, src: ~str) -> ProcRes { - compose_and_run(config, testfile, make_pp_args(config, testfile), + fn print_source(config: &Config, + props: &TestProps, + testfile: &Path, + src: ~str, + pretty_type: &str) -> ProcRes { + compose_and_run(config, testfile, + make_pp_args(config, props, testfile, pretty_type.to_owned()), Vec::new(), config.compile_lib_path, Some(src)) } |
