Skip to content

Commit fc7dbbd

Browse files
committed
Update to rust master
1 parent 3312468 commit fc7dbbd

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "conduit-test"
4-
version = "0.7.0"
4+
version = "0.7.1"
55
authors = ["[email protected]",
66
"Alex Crichton <[email protected]>"]
77
description = "Testing utilities for conduit-based stacks"

src/lib.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#![feature(io, core, net)]
1+
#![feature(core)]
22

33
extern crate semver;
44
extern crate conduit;
55

66
use std::collections::HashMap;
77
use std::io::prelude::*;
88
use std::io::Cursor;
9-
use std::net::IpAddr;
9+
use std::net::{SocketAddr, Ipv4Addr, SocketAddrV4};
1010

1111
use semver::Version;
1212
use conduit::{Method, Scheme, Host, Extensions, Headers, TypeMap};
@@ -109,8 +109,8 @@ impl conduit::Request for MockRequest {
109109
self.query_string.as_ref().map(|s| s.as_slice())
110110
}
111111

112-
fn remote_ip(&self) -> IpAddr {
113-
IpAddr::new_v4(127, 0, 0, 1)
112+
fn remote_addr(&self) -> SocketAddr {
113+
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 80))
114114
}
115115

116116
fn content_length(&self) -> Option<u64> {
@@ -142,7 +142,7 @@ mod tests {
142142
use super::MockRequest;
143143
use semver::Version;
144144

145-
use std::old_io::net::ip::Ipv4Addr;
145+
use std::net::{SocketAddr, SocketAddrV4, Ipv4Addr};
146146

147147
use conduit::{Request, Method, Host, Scheme};
148148

@@ -158,11 +158,14 @@ mod tests {
158158
assert_eq!(req.virtual_root(), None);
159159
assert_eq!(req.path(), "/");
160160
assert_eq!(req.query_string(), None);
161-
assert_eq!(req.remote_ip(), Ipv4Addr(127, 0, 0, 1));
161+
assert_eq!(req.remote_addr(),
162+
SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1),
163+
80)));
162164
assert_eq!(req.content_length(), None);
163165
assert_eq!(req.headers().all().len(), 0);
164-
assert_eq!(req.body().read_to_string().ok().expect("No body"),
165-
"".to_string());
166+
let mut s = String::new();
167+
req.body().read_to_string(&mut s).ok().expect("No body");
168+
assert_eq!(s, "".to_string());
166169
}
167170

168171
#[test]
@@ -172,8 +175,9 @@ mod tests {
172175

173176
assert_eq!(req.method(), Method::Post);
174177
assert_eq!(req.path(), "/articles");
175-
assert_eq!(req.body().read_to_string().ok().expect("No body"),
176-
"Hello world".to_string());
178+
let mut s = String::new();
179+
req.body().read_to_string(&mut s).ok().expect("No body");
180+
assert_eq!(s, "Hello world".to_string());
177181
assert_eq!(req.content_length(), Some(11));
178182
}
179183

0 commit comments

Comments
 (0)