Skip to content

Commit 62651df

Browse files
committed
Fix dvec-related fallout in tests
1 parent 59de385 commit 62651df

File tree

8 files changed

+17
-53
lines changed

8 files changed

+17
-53
lines changed

src/libcore/io.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1442,17 +1442,15 @@ mod tests {
14421442
fn bytes_buffer_overwrite() {
14431443
let wr = BytesWriter();
14441444
wr.write(~[0u8, 1u8, 2u8, 3u8]);
1445-
fail_unless!(wr.bytes.borrow(|bytes| bytes == ~[0u8, 1u8, 2u8, 3u8]));
1445+
fail_unless!(wr.bytes == ~[0u8, 1u8, 2u8, 3u8]);
14461446
wr.seek(-2, SeekCur);
14471447
wr.write(~[4u8, 5u8, 6u8, 7u8]);
1448-
fail_unless!(wr.bytes.borrow(|bytes| bytes ==
1449-
~[0u8, 1u8, 4u8, 5u8, 6u8, 7u8]));
1448+
fail_unless!(wr.bytes == ~[0u8, 1u8, 4u8, 5u8, 6u8, 7u8]);
14501449
wr.seek(-2, SeekEnd);
14511450
wr.write(~[8u8]);
14521451
wr.seek(1, SeekSet);
14531452
wr.write(~[9u8]);
1454-
fail_unless!(wr.bytes.borrow(|bytes| bytes ==
1455-
~[0u8, 9u8, 4u8, 5u8, 8u8, 7u8]));
1453+
fail_unless!(wr.bytes == ~[0u8, 9u8, 4u8, 5u8, 8u8, 7u8]);
14561454
}
14571455
14581456
#[test]

src/libstd/flatpipes.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,10 @@ pub mod flatteners {
452452
453453
pub fn serialize_value<D: Encoder + FromWriter,
454454
T: Encodable<D>>(val: &T) -> ~[u8] {
455-
let mut bytes_writer = BytesWriter();
456-
let writer = @bytes_writer as @Writer;
457-
let ser = FromWriter::from_writer(writer);
458-
val.encode(&ser);
459-
let mut ret = ~[];
460-
ret <-> bytes_writer.bytes;
461-
return ret;
455+
do io::with_bytes_writer |writer| {
456+
let ser = FromWriter::from_writer(writer);
457+
val.encode(&ser);
458+
}
462459
}
463460
464461
pub trait FromReader {
@@ -652,7 +649,7 @@ mod test {
652649
653650
chan.send(10);
654651
655-
let bytes = chan.byte_chan.writer.bytes.get();
652+
let bytes = copy chan.byte_chan.writer.bytes;
656653
657654
let reader = BufReader::new(bytes);
658655
let port = serial::reader_port(reader);
@@ -698,7 +695,7 @@ mod test {
698695
699696
chan.send(10);
700697
701-
let bytes = chan.byte_chan.writer.bytes.get();
698+
let bytes = copy chan.byte_chan.writer.bytes;
702699
703700
let reader = BufReader::new(bytes);
704701
let port = pod::reader_port(reader);

src/libstd/json.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,7 @@ mod tests {
13111311
}
13121312
}
13131313
}
1314-
check_equal(str::from_bytes(bw.bytes.data),
1315-
~"[\"frog\",[\"Henry\",349]]");
1314+
check_equal(str::from_bytes(bw.bytes), ~"[\"frog\",[\"Henry\",349]]");
13161315
}
13171316
13181317
#[test]
@@ -1327,8 +1326,7 @@ mod tests {
13271326
}
13281327
}
13291328
}
1330-
check_equal(str::from_bytes(bw.bytes.data),
1331-
~"\"jodhpurs\"");
1329+
check_equal(str::from_bytes(bw.bytes), ~"\"jodhpurs\"");
13321330
}
13331331

13341332
#[test]
@@ -1340,8 +1338,7 @@ mod tests {
13401338
do encoder.emit_enum_variant (~"None",37,1242) {
13411339
}
13421340
}
1343-
check_equal(str::from_bytes(bw.bytes.data),
1344-
~"null");
1341+
check_equal(str::from_bytes(bw.bytes), ~"null");
13451342
}
13461343
13471344
#[test]

src/libsyntax/parse/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ mod test {
303303
use util::testing::*;
304304

305305
#[test] fn to_json_str (val: Encodable<std::json::Encoder>) -> ~str {
306-
let bw = @io::BytesWriter();
307-
val.encode(~std::json::Encoder(bw as io::Writer));
308-
str::from_bytes(bw.bytes.data)
306+
do io::with_str_writer |writer| {
307+
val.encode(~std::json::Encoder(writer));
308+
}
309309
}
310310

311311
#[test] fn alltts () {

src/test/run-pass/call-closure-from-overloaded-op.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn foo() -> int { 22 }
1212

1313
pub fn main() {
14-
let x: ~[@fn() -> int] = ~[];
14+
let mut x: ~[@fn() -> int] = ~[];
1515
x.push(foo);
1616
fail_unless!((x[0])() == 22);
1717
}

src/test/run-pass/issue-2631-b.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ extern mod req;
1515
extern mod std;
1616

1717
use req::*;
18-
use std::oldmap::*;
1918
use std::oldmap::HashMap;
2019

2120
pub fn main() {
2221
let v = ~[@~"hi"];
2322
let m: req::header_map = HashMap();
24-
m.insert(~"METHOD", @mut ~[v]);
23+
m.insert(~"METHOD", @mut v);
2524
request::<int>(m);
2625
}

src/test/run-pass/issue-5275

-15.8 KB
Binary file not shown.

src/test/run-pass/issue-5275.rs

-27
This file was deleted.

0 commit comments

Comments
 (0)