about summary refs log tree commit diff
path: root/src/compiletest
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-10-28 21:19:59 -0700
committerBrian Anderson <banderson@mozilla.com>2011-10-29 01:25:11 -0700
commit2cebef095e61608a3d35710cb5fd3d7de18b68ac (patch)
treecb24a5d2506444d157edfe16fac08f2d31892a28 /src/compiletest
parent2b62a80202e2855d47f20d271842e0e9aec6d8e2 (diff)
stdlib: Make io failures recoverable by returning a result
Diffstat (limited to 'src/compiletest')
-rw-r--r--src/compiletest/header.rs2
-rw-r--r--src/compiletest/runtest.rs8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs
index 60ff2dc0967..93fbdd3dead 100644
--- a/src/compiletest/header.rs
+++ b/src/compiletest/header.rs
@@ -63,7 +63,7 @@ fn is_test_ignored(config: config, testfile: str) -> bool {
 }
 
 fn iter_header(testfile: str, it: block(str)) {
-    let rdr = io::file_reader(testfile);
+    let rdr = std::result::get(io::file_reader(testfile));
     while !rdr.eof() {
         let ln = rdr.read_line();
 
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs
index 2697f8bbc98..198ef5e1101 100644
--- a/src/compiletest/runtest.rs
+++ b/src/compiletest/runtest.rs
@@ -5,6 +5,7 @@ import std::fs;
 import std::os;
 import std::vec;
 import std::test;
+import std::result;
 
 import common::mode_run_pass;
 import common::mode_run_fail;
@@ -92,7 +93,7 @@ fn run_pretty_test(cx: cx, props: test_props, testfile: str) {
     let rounds =
         alt props.pp_exact { option::some(_) { 1 } option::none. { 2 } };
 
-    let srcs = [io::read_whole_file_str(testfile)];
+    let srcs = [result::get(io::read_whole_file_str(testfile))];
 
     let round = 0;
     while round < rounds {
@@ -112,7 +113,7 @@ fn run_pretty_test(cx: cx, props: test_props, testfile: str) {
         alt props.pp_exact {
           option::some(file) {
             let filepath = fs::connect(fs::dirname(testfile), file);
-            io::read_whole_file_str(filepath)
+            result::get(io::read_whole_file_str(filepath))
           }
           option::none. { srcs[vec::len(srcs) - 2u] }
         };
@@ -339,7 +340,8 @@ fn dump_output(config: config, testfile: str, out: str, err: str) {
 #[cfg(target_os = "linux")]
 fn dump_output_file(config: config, testfile: str, out: str, extension: str) {
     let outfile = make_out_name(config, testfile, extension);
-    let writer = io::file_writer(outfile, [io::create, io::truncate]);
+    let writer = result::get(
+        io::file_writer(outfile, [io::create, io::truncate]));
     writer.write_str(out);
 }