diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-07-11 12:05:17 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-07-17 14:57:54 -0700 |
| commit | 2dbb3c3887ff23c064aa762eb4dafaf4967c6416 (patch) | |
| tree | 6d143b2480375aa7a5e56a22a37e29e215a51af3 /src/libstd | |
| parent | e20549ff192edec9d625f1119bcb077c3abaf070 (diff) | |
| download | rust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.tar.gz rust-2dbb3c3887ff23c064aa762eb4dafaf4967c6416.zip | |
test: Fix tests.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io.rs | 40 | ||||
| -rw-r--r-- | src/libstd/rt/uv/net.rs | 2 | ||||
| -rw-r--r-- | src/libstd/to_str.rs | 1 | ||||
| -rw-r--r-- | src/libstd/vec.rs | 2 |
4 files changed, 21 insertions, 24 deletions
diff --git a/src/libstd/io.rs b/src/libstd/io.rs index e074eba68ae..338f9335806 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -1856,11 +1856,11 @@ mod tests { debug!(frood.clone()); { let out: @io::Writer = - result::get( - &io::file_writer(tmpfile, [io::Create, io::Truncate])); + result::unwrap( + io::file_writer(tmpfile, [io::Create, io::Truncate])); out.write_str(frood); } - let inp: @io::Reader = result::get(&io::file_reader(tmpfile)); + let inp: @io::Reader = result::unwrap(io::file_reader(tmpfile)); let frood2: ~str = inp.read_c_str(); debug!(frood2.clone()); assert_eq!(frood, frood2); @@ -1958,10 +1958,10 @@ mod tests { fn test_read_buffer_too_small() { let path = &Path("tmp/lib-io-test-read-buffer-too-small.tmp"); // ensure the file exists - io::file_writer(path, [io::Create]).get(); + io::file_writer(path, [io::Create]).unwrap(); - let file = io::file_reader(path).get(); - let mut buf = vec::from_elem(5, 0); + let file = io::file_reader(path).unwrap(); + let mut buf = vec::from_elem(5, 0u8); file.read(buf, 6); // this should fail because buf is too small } @@ -1969,17 +1969,17 @@ mod tests { fn test_read_buffer_big_enough() { let path = &Path("tmp/lib-io-test-read-buffer-big-enough.tmp"); // ensure the file exists - io::file_writer(path, [io::Create]).get(); + io::file_writer(path, [io::Create]).unwrap(); - let file = io::file_reader(path).get(); - let mut buf = vec::from_elem(5, 0); + let file = io::file_reader(path).unwrap(); + let mut buf = vec::from_elem(5, 0u8); file.read(buf, 4); // this should succeed because buf is big enough } #[test] fn test_write_empty() { let file = io::file_writer(&Path("tmp/lib-io-test-write-empty.tmp"), - [io::Create]).get(); + [io::Create]).unwrap(); file.write([]); } @@ -2025,7 +2025,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for uints.iter().advance |i| { file.write_le_u64(*i); } @@ -2033,7 +2033,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for uints.iter().advance |i| { assert_eq!(file.read_le_u64(), *i); } @@ -2047,7 +2047,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for uints.iter().advance |i| { file.write_be_u64(*i); } @@ -2055,7 +2055,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for uints.iter().advance |i| { assert_eq!(file.read_be_u64(), *i); } @@ -2069,7 +2069,7 @@ mod tests { // write the ints to the file { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); for ints.iter().advance |i| { file.write_be_i32(*i); } @@ -2077,7 +2077,7 @@ mod tests { // then read them back and check that they are the same { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); for ints.iter().advance |i| { // this tests that the sign extension is working // (comparing the values as i32 would not test this) @@ -2093,12 +2093,12 @@ mod tests { let buf = ~[0x41, 0x02, 0x00, 0x00]; { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); file.write(buf); } { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); let f = file.read_be_f32(); assert_eq!(f, 8.1250); } @@ -2110,13 +2110,13 @@ mod tests { let f:f32 = 8.1250; { - let file = io::file_writer(&path, [io::Create]).get(); + let file = io::file_writer(&path, [io::Create]).unwrap(); file.write_be_f32(f); file.write_le_f32(f); } { - let file = io::file_reader(&path).get(); + let file = io::file_reader(&path).unwrap(); assert_eq!(file.read_be_f32(), 8.1250); assert_eq!(file.read_le_f32(), 8.1250); } diff --git a/src/libstd/rt/uv/net.rs b/src/libstd/rt/uv/net.rs index 09c748ec047..ec6e909219d 100644 --- a/src/libstd/rt/uv/net.rs +++ b/src/libstd/rt/uv/net.rs @@ -736,7 +736,7 @@ mod test { let server_stream_watcher = server_stream_watcher; rtdebug!("starting read"); let alloc: AllocCallback = |size| { - vec_to_uv_buf(vec::from_elem(size, 0)) + vec_to_uv_buf(vec::from_elem(size, 0u8)) }; do client_tcp_watcher.read_start(alloc) |stream_watcher, nread, buf, status| { diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index 0c82df7e43a..b655dc828bf 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -178,7 +178,6 @@ impl<A:ToStr> ToStr for @[A] { } #[cfg(test)] -#[allow(non_implicitly_copyable_typarams)] mod tests { use hashmap::HashMap; use hashmap::HashSet; diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index c9c5217ca61..e380cc36b32 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -3049,7 +3049,6 @@ mod tests { #[test] #[ignore(windows)] #[should_fail] - #[allow(non_implicitly_copyable_typarams)] fn test_grow_fn_fail() { let mut v = ~[]; do v.grow_fn(100) |i| { @@ -3108,7 +3107,6 @@ mod tests { #[test] #[ignore(windows)] #[should_fail] - #[allow(non_implicitly_copyable_typarams)] fn test_permute_fail() { let v = [(~0, @0), (~0, @0), (~0, @0), (~0, @0)]; let mut i = 0; |
