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`.
This commit is contained in:
parent
96eeda9708
commit
ce8c467bd2
@ -157,9 +157,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
|
|||||||
let mut round = 0;
|
let mut round = 0;
|
||||||
while round < rounds {
|
while round < rounds {
|
||||||
logv(config, format!("pretty-printing round {}", round));
|
logv(config, format!("pretty-printing round {}", round));
|
||||||
let proc_res = print_source(config,
|
let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "normal");
|
||||||
testfile,
|
|
||||||
(*srcs.get(round)).clone());
|
|
||||||
|
|
||||||
if !proc_res.status.success() {
|
if !proc_res.status.success() {
|
||||||
fatal_ProcRes(format!("pretty-printing failed in round {}", round),
|
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);
|
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;
|
return;
|
||||||
|
|
||||||
fn print_source(config: &Config, testfile: &Path, src: ~str) -> ProcRes {
|
fn print_source(config: &Config,
|
||||||
compose_and_run(config, testfile, make_pp_args(config, testfile),
|
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))
|
Vec::new(), config.compile_lib_path, Some(src))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
// error-pattern:runned an unexported test
|
// error-pattern:runned an unexported test
|
||||||
// compile-flags:--test
|
// compile-flags:--test
|
||||||
// check-stdout
|
// check-stdout
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
mod m {
|
mod m {
|
||||||
pub fn exported() { }
|
pub fn exported() { }
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
// check-stdout
|
// check-stdout
|
||||||
// error-pattern:task 'test_foo' failed at
|
// error-pattern:task 'test_foo' failed at
|
||||||
// compile-flags: --test
|
// compile-flags: --test
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_foo() {
|
fn test_foo() {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
// error-pattern:should be a positive integer
|
// error-pattern:should be a positive integer
|
||||||
// compile-flags: --test
|
// compile-flags: --test
|
||||||
// exec-env:RUST_TEST_TASKS=foo
|
// exec-env:RUST_TEST_TASKS=foo
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn do_nothing() {}
|
fn do_nothing() {}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// ignore-android
|
// ignore-android
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#![feature(quote)]
|
#![feature(quote)]
|
||||||
#![deny(unused_variable)]
|
#![deny(unused_variable)]
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// ignore-pretty: pprust doesn't print hygiene output
|
||||||
|
|
||||||
#![feature(macro_rules)]
|
#![feature(macro_rules)]
|
||||||
|
|
||||||
macro_rules! loop_x {
|
macro_rules! loop_x {
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
// ignore-pretty: `--pretty expand` creates unnecessary `unsafe` block
|
||||||
|
|
||||||
#![feature(macro_rules, managed_boxes)]
|
#![feature(macro_rules, managed_boxes)]
|
||||||
#![deny(warnings)]
|
#![deny(warnings)]
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// pp-exact
|
// ignore-pretty: `expand` addes some preludes before shebang
|
||||||
|
|
||||||
pub fn main() { println!("Hello World"); }
|
pub fn main() { println!("Hello World"); }
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// compile-flags: --test --cfg ignorecfg
|
// compile-flags: --test --cfg ignorecfg
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore(cfg(ignorecfg))]
|
#[ignore(cfg(ignorecfg))]
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
// compile-flags:--test
|
// compile-flags:--test
|
||||||
// ignore-win32 #10872
|
// ignore-win32 #10872
|
||||||
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
// Building as a test runner means that a synthetic main will be run,
|
// Building as a test runner means that a synthetic main will be run,
|
||||||
// not ours
|
// not ours
|
||||||
|
Loading…
Reference in New Issue
Block a user