about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-07-30 21:44:30 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-02 10:39:12 -0700
commit4e8ab8b3a8fa324754023feeb4406482c4643feb (patch)
treef69d5d8bd4339021c2fa035df48d35ec180877d3 /src
parentaf2eecdabec206789a333e2bb13675ead4b1fbbf (diff)
downloadrust-4e8ab8b3a8fa324754023feeb4406482c4643feb.tar.gz
rust-4e8ab8b3a8fa324754023feeb4406482c4643feb.zip
Introduce pretty-print testing mode to compiletest. Issue #789
Diffstat (limited to 'src')
-rw-r--r--src/test/compiletest/common.rs7
-rw-r--r--src/test/compiletest/compiletest.rs9
-rw-r--r--src/test/compiletest/runtest.rs5
3 files changed, 19 insertions, 2 deletions
diff --git a/src/test/compiletest/common.rs b/src/test/compiletest/common.rs
index d0fe2ebb1cf..f5a60bd0261 100644
--- a/src/test/compiletest/common.rs
+++ b/src/test/compiletest/common.rs
@@ -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
diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs
index a96dab380ef..8e90c921fa6 100644
--- a/src/test/compiletest/compiletest.rs
+++ b/src/test/compiletest/compiletest.rs
@@ -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:
 
diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs
index 9355ed5620e..117d5651bca 100644
--- a/src/test/compiletest/runtest.rs
+++ b/src/test/compiletest/runtest.rs
@@ -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) {