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),
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))
}