diff --git a/Cargo.toml b/Cargo.toml index 079d006ed1cb1d3d680f3c9e8c087a1333b844e9..7980902277f708b2afba17bc25f38cbd80426436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ exclude = [ ] [dev-dependencies] -rand = "0.1.2" +rand = "0.2.1" [[bench]] diff --git a/src/lib.rs b/src/lib.rs index 70b9deda59787337fe4db4f6870cc18de5b4fbd8..c4ce64efb5822504fee29ccefd9e59fca88fb87d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,7 +61,7 @@ pub trait Buf { /// let mut dst = [0; 5]; /// /// buf.read_slice(&mut dst); - /// assert_eq!(b"hello", dst); + /// assert_eq!(b"hello", &dst); /// assert_eq!(6, buf.remaining()); /// ``` fn read_slice(&mut self, dst: &mut [u8]) -> usize { @@ -144,7 +144,7 @@ pub trait MutBuf : Sized { /// assert_eq!(1, buf.remaining()); /// } /// - /// assert_eq!(b"hello\0", dst); + /// assert_eq!(b"hello\0", &dst); /// ``` fn write_slice(&mut self, src: &[u8]) -> usize { let mut off = 0; diff --git a/test/test_byte_buf.rs b/test/test_byte_buf.rs index 275dd0e67367b17191ea6d32eb33c86e24e5b127..3cbe009e1239d96e875a5868d82bfd19a939aa6b 100644 --- a/test/test_byte_buf.rs +++ b/test/test_byte_buf.rs @@ -21,26 +21,26 @@ pub fn test_initial_buf_empty() { pub fn test_byte_buf_read_write() { let mut buf = ByteBuf::mut_with_capacity(32); - buf.write(b"hello world").unwrap(); + buf.write(b"hello world".as_slice()).unwrap(); assert_eq!(21, buf.remaining()); - buf.write(b" goodbye").unwrap(); + buf.write(b" goodbye".as_slice()).unwrap(); assert_eq!(13, buf.remaining()); let mut buf = buf.flip(); let mut dst = [0; 5]; assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap()); - assert_eq!(b"hello", dst); + assert_eq!(b"hello", &dst); assert_eq!(5, buf.read(dst.as_mut_slice()).unwrap()); - assert_eq!(b" worl", dst); + assert_eq!(b" worl", &dst); let mut dst = [0; 2]; assert_eq!(2, buf.read(dst.as_mut_slice()).unwrap()); - assert_eq!(b"d ", dst); + assert_eq!(b"d ", &dst); let mut dst = [0; 7]; assert_eq!(7, buf.read(dst.as_mut_slice()).unwrap()); - assert_eq!(b"goodbye", dst); + assert_eq!(b"goodbye", &dst); } diff --git a/test/test_rope.rs b/test/test_rope.rs index cf0a7f21f3cdf2e40f4855bccbb19b3661186af7..af7870eeeca48ae92832363e6983f47ed7051e78 100644 --- a/test/test_rope.rs +++ b/test/test_rope.rs @@ -3,29 +3,29 @@ use bytes::traits::*; use super::gen_bytes; const TEST_BYTES_1: &'static [u8] = - &b"dblm4ng7jp4v9rdn1w6hhssmluoqrrrqj59rccl9 - nkv2tm1t2da4jyku51ge7f8hv581gkki8lekmf5f - 1l44whp4aiwbvhkziw02292on4noyvuwjzsloqyc - 5n0iyn4l6o6tgjhlek00mynfzb1wgcwj4mqp6zdr - 3625yy7rj7xuisal7b1a7xgq271abvt5ssxuj39v - njtetokxxrgxzp7ik9adnypkmmcn4270yv9l46m7 - 9mu2zmqmkxdmgia210vkdytb7ywfcyt2bvcsg9eq - 5yqizxl6888zrksvaxhzs2v355jxu8gr21m33t83 - qvoian1ra7c6pvxabshgngldxa408p18l1fdet2h"; + b"dblm4ng7jp4v9rdn1w6hhssmluoqrrrqj59rccl9 + nkv2tm1t2da4jyku51ge7f8hv581gkki8lekmf5f + 1l44whp4aiwbvhkziw02292on4noyvuwjzsloqyc + 5n0iyn4l6o6tgjhlek00mynfzb1wgcwj4mqp6zdr + 3625yy7rj7xuisal7b1a7xgq271abvt5ssxuj39v + njtetokxxrgxzp7ik9adnypkmmcn4270yv9l46m7 + 9mu2zmqmkxdmgia210vkdytb7ywfcyt2bvcsg9eq + 5yqizxl6888zrksvaxhzs2v355jxu8gr21m33t83 + qvoian1ra7c6pvxabshgngldxa408p18l1fdet2h"; const TEST_BYTES_2: &'static [u8] = - &b"jmh14t79mllzj1ohxfj6fun7idwbks8oh35f83g6 - ryaowe86mmou5t1xa91uyg8e95wcu5mje1mswien - tt4clgj029cw0pyuvfbvsgzdg1x7sr9qsjkf2b1t - h43smgp1ea22lph17f78cel0cc2kjoht5281xuy8 - 0ex9uaqwj4330jrp30stsk15j9bpqezu3w78ktit - ev5g6xsngr35q7pemdm9hihf0ebrw5fbwhm530lo - e0zyj1bm7yfyk7f2i45jhr3wu3bvb4hj8jve6db0 - iewmr9weecaon9vdnqo5hen9iaiox5vsaxuo461m - 8336ugp20u4sfky3kfawr0ome1tiqyx8chkerrjh - a95s0gypcsgo9jqxasqkoj08t4uq5moxmay5plg5 - tlh6f9omhn0ezvi0w2n8hx7n6qk7rn1s3mjpnpl6 - hvilp8awaa4tvsis66q4e5b3xwy2z1h2klpa87h7"; + b"jmh14t79mllzj1ohxfj6fun7idwbks8oh35f83g6 + ryaowe86mmou5t1xa91uyg8e95wcu5mje1mswien + tt4clgj029cw0pyuvfbvsgzdg1x7sr9qsjkf2b1t + h43smgp1ea22lph17f78cel0cc2kjoht5281xuy8 + 0ex9uaqwj4330jrp30stsk15j9bpqezu3w78ktit + ev5g6xsngr35q7pemdm9hihf0ebrw5fbwhm530lo + e0zyj1bm7yfyk7f2i45jhr3wu3bvb4hj8jve6db0 + iewmr9weecaon9vdnqo5hen9iaiox5vsaxuo461m + 8336ugp20u4sfky3kfawr0ome1tiqyx8chkerrjh + a95s0gypcsgo9jqxasqkoj08t4uq5moxmay5plg5 + tlh6f9omhn0ezvi0w2n8hx7n6qk7rn1s3mjpnpl6 + hvilp8awaa4tvsis66q4e5b3xwy2z1h2klpa87h7"; #[test] pub fn test_rope_round_trip() {