Introduce pretty-print testing mode to compiletest. Issue #789

This commit is contained in:
Brian Anderson 2011-07-30 21:44:30 -07:00
parent af2eecdabe
commit 4e8ab8b3a8
4 changed files with 32 additions and 2 deletions

View file

@ -1,6 +1,11 @@
import std::option;
tag mode { mode_compile_fail; mode_run_fail; mode_run_pass; }
tag mode {
mode_compile_fail;
mode_run_fail;
mode_run_pass;
mode_pretty;
}
type config = {
// The library paths required for running the compiler

View file

@ -12,6 +12,7 @@ import common::config;
import common::mode_run_pass;
import common::mode_run_fail;
import common::mode_compile_fail;
import common::mode_pretty;
import common::mode;
import util::logv;
@ -89,6 +90,7 @@ fn str_mode(s: str) -> mode {
"compile-fail" { mode_compile_fail }
"run-fail" { mode_run_fail }
"run-pass" { mode_run_pass }
"pretty" { mode_pretty }
_ { fail "invalid mode" }
}
}
@ -98,6 +100,7 @@ fn mode_str(mode: mode) -> str {
mode_compile_fail. { "compile-fail" }
mode_run_fail. { "run-fail" }
mode_run_pass. { "run-pass" }
mode_pretty. { "pretty" }
}
}
@ -136,11 +139,15 @@ fn is_test(testfile: &str) -> bool {
fn make_test(cx: &cx, testfile: &str, configport: &port[str]) ->
test::test_desc {
{name: testfile,
{name: make_test_name(cx.config, testfile),
fn: make_test_closure(testfile, chan(configport)),
ignore: header::is_test_ignored(cx.config.stage_id, testfile)}
}
fn make_test_name(config: &config, testfile: &str) -> str {
#fmt("[%s] %s", mode_str(config.mode), testfile)
}
/*
So this is kind of crappy:

View file

@ -10,6 +10,7 @@ import std::test;
import common::mode_run_pass;
import common::mode_run_fail;
import common::mode_compile_fail;
import common::mode_pretty;
import common::cx;
import common::config;
import header::load_props;
@ -30,6 +31,7 @@ fn run(cx: &cx, testfile: &str) {
mode_compile_fail. { run_cfail_test(cx, props, testfile); }
mode_run_fail. { run_rfail_test(cx, props, testfile); }
mode_run_pass. { run_rpass_test(cx, props, testfile); }
mode_pretty. { run_pretty_test(cx, props, testfile); }
}
}
@ -72,6 +74,9 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) {
if procres.status != 0 { fatal_procres("test run failed!", procres); }
}
fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) {
}
fn check_error_patterns(props: &test_props, testfile: &str,
procres: &procres) {
if ivec::is_empty(props.error_patterns) {