about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-03-07 23:44:38 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-03-08 09:56:52 -0500
commit62651df2b482af4dc98b0aec6c5f1ad112fab8ec (patch)
tree70dd00fbb69807cc2dcab84b9ad5803fe06e57bf
parent59de3853be3b7d9e5306522bdfdb76be69555703 (diff)
Fix dvec-related fallout in tests
-rw-r--r--src/libcore/io.rs8
-rw-r--r--src/libstd/flatpipes.rs15
-rw-r--r--src/libstd/json.rs9
-rw-r--r--src/libsyntax/parse/mod.rs6
-rw-r--r--src/test/run-pass/call-closure-from-overloaded-op.rs2
-rw-r--r--src/test/run-pass/issue-2631-b.rs3
-rwxr-xr-xsrc/test/run-pass/issue-5275bin16176 -> 0 bytes
-rw-r--r--src/test/run-pass/issue-5275.rs27
8 files changed, 17 insertions, 53 deletions
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index 34fa4c972ea..4634eb8793d 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -1442,17 +1442,15 @@ mod tests {
     fn bytes_buffer_overwrite() {
         let wr = BytesWriter();
         wr.write(~[0u8, 1u8, 2u8, 3u8]);
-        fail_unless!(wr.bytes.borrow(|bytes| bytes == ~[0u8, 1u8, 2u8, 3u8]));
+        fail_unless!(wr.bytes == ~[0u8, 1u8, 2u8, 3u8]);
         wr.seek(-2, SeekCur);
         wr.write(~[4u8, 5u8, 6u8, 7u8]);
-        fail_unless!(wr.bytes.borrow(|bytes| bytes ==
-            ~[0u8, 1u8, 4u8, 5u8, 6u8, 7u8]));
+        fail_unless!(wr.bytes == ~[0u8, 1u8, 4u8, 5u8, 6u8, 7u8]);
         wr.seek(-2, SeekEnd);
         wr.write(~[8u8]);
         wr.seek(1, SeekSet);
         wr.write(~[9u8]);
-        fail_unless!(wr.bytes.borrow(|bytes| bytes ==
-            ~[0u8, 9u8, 4u8, 5u8, 8u8, 7u8]));
+        fail_unless!(wr.bytes == ~[0u8, 9u8, 4u8, 5u8, 8u8, 7u8]);
     }
 
     #[test]
diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs
index b117834238f..897cb4c2034 100644
--- a/src/libstd/flatpipes.rs
+++ b/src/libstd/flatpipes.rs
@@ -452,13 +452,10 @@ pub mod flatteners {
 
     pub fn serialize_value<D: Encoder + FromWriter,
                            T: Encodable<D>>(val: &T) -> ~[u8] {
-        let mut bytes_writer = BytesWriter();
-        let writer = @bytes_writer as @Writer;
-        let ser = FromWriter::from_writer(writer);
-        val.encode(&ser);
-        let mut ret = ~[];
-        ret <-> bytes_writer.bytes;
-        return ret;
+        do io::with_bytes_writer |writer| {
+            let ser = FromWriter::from_writer(writer);
+            val.encode(&ser);
+        }
     }
 
     pub trait FromReader {
@@ -652,7 +649,7 @@ mod test {
 
         chan.send(10);
 
-        let bytes = chan.byte_chan.writer.bytes.get();
+        let bytes = copy chan.byte_chan.writer.bytes;
 
         let reader = BufReader::new(bytes);
         let port = serial::reader_port(reader);
@@ -698,7 +695,7 @@ mod test {
 
         chan.send(10);
 
-        let bytes = chan.byte_chan.writer.bytes.get();
+        let bytes = copy chan.byte_chan.writer.bytes;
 
         let reader = BufReader::new(bytes);
         let port = pod::reader_port(reader);
diff --git a/src/libstd/json.rs b/src/libstd/json.rs
index 6506d8e3c41..9208d415971 100644
--- a/src/libstd/json.rs
+++ b/src/libstd/json.rs
@@ -1311,8 +1311,7 @@ mod tests {
                 }
             }
         }
-        check_equal(str::from_bytes(bw.bytes.data),
-                    ~"[\"frog\",[\"Henry\",349]]");
+        check_equal(str::from_bytes(bw.bytes), ~"[\"frog\",[\"Henry\",349]]");
     }
 
     #[test]
@@ -1327,8 +1326,7 @@ mod tests {
                 }
             }
         }
-        check_equal(str::from_bytes(bw.bytes.data),
-                    ~"\"jodhpurs\"");
+        check_equal(str::from_bytes(bw.bytes), ~"\"jodhpurs\"");
     }
 
     #[test]
@@ -1340,8 +1338,7 @@ mod tests {
             do encoder.emit_enum_variant (~"None",37,1242) {
             }
         }
-        check_equal(str::from_bytes(bw.bytes.data),
-                    ~"null");
+        check_equal(str::from_bytes(bw.bytes), ~"null");
     }
 
     #[test]
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 48d3fbe8889..a1fc7230dd1 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -303,9 +303,9 @@ mod test {
     use util::testing::*;
 
     #[test] fn to_json_str (val: Encodable<std::json::Encoder>) -> ~str {
-        let bw = @io::BytesWriter();
-        val.encode(~std::json::Encoder(bw as io::Writer));
-        str::from_bytes(bw.bytes.data)
+        do io::with_str_writer |writer| {
+            val.encode(~std::json::Encoder(writer));
+        }
     }
 
     #[test] fn alltts () {
diff --git a/src/test/run-pass/call-closure-from-overloaded-op.rs b/src/test/run-pass/call-closure-from-overloaded-op.rs
index cbfae48302b..39864059fcd 100644
--- a/src/test/run-pass/call-closure-from-overloaded-op.rs
+++ b/src/test/run-pass/call-closure-from-overloaded-op.rs
@@ -11,7 +11,7 @@
 fn foo() -> int { 22 }
 
 pub fn main() {
-    let x: ~[@fn() -> int] = ~[];
+    let mut x: ~[@fn() -> int] = ~[];
     x.push(foo);
     fail_unless!((x[0])() == 22);
 }
diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs
index 66383253f7c..5f5e2f9fc30 100644
--- a/src/test/run-pass/issue-2631-b.rs
+++ b/src/test/run-pass/issue-2631-b.rs
@@ -15,12 +15,11 @@ extern mod req;
 extern mod std;
 
 use req::*;
-use std::oldmap::*;
 use std::oldmap::HashMap;
 
 pub fn main() {
   let v = ~[@~"hi"];
   let m: req::header_map = HashMap();
-  m.insert(~"METHOD", @mut ~[v]);
+  m.insert(~"METHOD", @mut v);
   request::<int>(m);
 }
diff --git a/src/test/run-pass/issue-5275 b/src/test/run-pass/issue-5275
deleted file mode 100755
index ea8edf5156a..00000000000
--- a/src/test/run-pass/issue-5275
+++ /dev/null
Binary files differdiff --git a/src/test/run-pass/issue-5275.rs b/src/test/run-pass/issue-5275.rs
deleted file mode 100644
index a1b93d99f28..00000000000
--- a/src/test/run-pass/issue-5275.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn foo(self: &A) -> int {
-    if true {
-        fail!()
-    } else {
-        *bar(self.bar)
-    }
-}
-
-pub fn main() {}
-
-fn bar(_: &r/mut int) -> &r/int {
-    fail!()
-}
-
-struct A {
-  bar: @mut int,
-}