about summary refs log tree commit diff
path: root/src/libtest
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-18 08:36:39 +0000
committerbors <bors@rust-lang.org>2014-11-18 08:36:39 +0000
commitfcb1523241cd682abc9a0622efe9877fbac53231 (patch)
tree4b7d4cbdd13006e15f2780a0dabb8f338ee7567f /src/libtest
parentf637f1c5a27b2d8023342163c6ac5c394d91c1fe (diff)
parent85c2c2e38ce7c606fac1e9c8fa9d2ab71b35c8c8 (diff)
downloadrust-fcb1523241cd682abc9a0622efe9877fbac53231.tar.gz
rust-fcb1523241cd682abc9a0622efe9877fbac53231.zip
auto merge of #18885 : thestinger/rust/writer, r=aturon
The trait has an obvious, sensible implementation directly on vectors so
the MemWriter wrapper is unnecessary. This will halt the trend towards
providing all of the vector methods on MemWriter along with eliminating
the noise caused by conversions between the two types. It also provides
the useful default Writer methods on Vec<u8>.

After the type is removed and code has been migrated, it would make
sense to add a new implementation of MemWriter with seeking support. The
simple use cases can be covered with vectors alone, and ones with the
need for seeks can use a new MemWriter implementation.
Diffstat (limited to 'src/libtest')
-rw-r--r--src/libtest/lib.rs8
-rw-r--r--src/libtest/stats.rs5
2 files changed, 5 insertions, 8 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 8266765ba3f..d5d0e7aeb17 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -33,7 +33,7 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/")]
 
-#![feature(asm, macro_rules, phase, globs)]
+#![feature(asm, macro_rules, phase, globs, slicing_syntax)]
 
 extern crate getopts;
 extern crate regex;
@@ -848,8 +848,6 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn> ) -> io::IoR
 
 #[test]
 fn should_sort_failures_before_printing_them() {
-    use std::io::MemWriter;
-
     let test_a = TestDesc {
         name: StaticTestName("a"),
         ignore: false,
@@ -864,7 +862,7 @@ fn should_sort_failures_before_printing_them() {
 
     let mut st = ConsoleTestState {
         log_out: None,
-        out: Raw(MemWriter::new()),
+        out: Raw(Vec::new()),
         use_color: false,
         total: 0u,
         passed: 0u,
@@ -878,7 +876,7 @@ fn should_sort_failures_before_printing_them() {
 
     st.write_failures().unwrap();
     let s = match st.out {
-        Raw(ref m) => String::from_utf8_lossy(m.get_ref()),
+        Raw(ref m) => String::from_utf8_lossy(m[]),
         Pretty(_) => unreachable!()
     };
 
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 5161d1de7ee..ab6756ffce3 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -1027,10 +1027,9 @@ mod tests {
     #[test]
     fn test_boxplot_nonpositive() {
         fn t(s: &Summary<f64>, expected: String) {
-            use std::io::MemWriter;
-            let mut m = MemWriter::new();
+            let mut m = Vec::new();
             write_boxplot(&mut m as &mut io::Writer, s, 30).unwrap();
-            let out = String::from_utf8(m.unwrap()).unwrap();
+            let out = String::from_utf8(m).unwrap();
             assert_eq!(out, expected);
         }