extra: Fix tests with io_error usage
This commit is contained in:
parent
209642c651
commit
41cde566bb
9 changed files with 28 additions and 27 deletions
|
@ -637,7 +637,7 @@ mod tests {
|
|||
fn test_mutex_arc_poison() {
|
||||
let arc = ~MutexArc::new(1);
|
||||
let arc2 = ~arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.access(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
})
|
||||
|
@ -668,7 +668,7 @@ mod tests {
|
|||
fn test_mutex_arc_access_in_unwind() {
|
||||
let arc = MutexArc::new(1i);
|
||||
let arc2 = arc.clone();
|
||||
task::try::<()>(proc() {
|
||||
let _ = task::try::<()>(proc() {
|
||||
struct Unwinder {
|
||||
i: MutexArc<int>
|
||||
}
|
||||
|
@ -687,7 +687,7 @@ mod tests {
|
|||
fn test_rw_arc_poison_wr() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.write(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
})
|
||||
|
@ -701,7 +701,7 @@ mod tests {
|
|||
fn test_rw_arc_poison_ww() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.write(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
})
|
||||
|
@ -714,7 +714,7 @@ mod tests {
|
|||
fn test_rw_arc_poison_dw() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.write_downgrade(|mut write_mode| {
|
||||
write_mode.write(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
|
@ -729,7 +729,7 @@ mod tests {
|
|||
fn test_rw_arc_no_poison_rr() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.read(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
})
|
||||
|
@ -742,7 +742,7 @@ mod tests {
|
|||
fn test_rw_arc_no_poison_rw() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.read(|one| {
|
||||
assert_eq!(*one, 2);
|
||||
})
|
||||
|
@ -755,7 +755,7 @@ mod tests {
|
|||
fn test_rw_arc_no_poison_dr() {
|
||||
let arc = RWArc::new(1);
|
||||
let arc2 = arc.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
arc2.write_downgrade(|write_mode| {
|
||||
let read_mode = arc2.downgrade(write_mode);
|
||||
read_mode.read(|one| {
|
||||
|
@ -800,7 +800,7 @@ mod tests {
|
|||
|
||||
// Wait for children to pass their asserts
|
||||
for r in children.mut_iter() {
|
||||
r.recv();
|
||||
let _ = r.recv();
|
||||
}
|
||||
|
||||
// Wait for writer to finish
|
||||
|
@ -814,7 +814,7 @@ mod tests {
|
|||
fn test_rw_arc_access_in_unwind() {
|
||||
let arc = RWArc::new(1i);
|
||||
let arc2 = arc.clone();
|
||||
task::try::<()>(proc() {
|
||||
let _ = task::try::<()>(proc() {
|
||||
struct Unwinder {
|
||||
i: RWArc<int>
|
||||
}
|
||||
|
|
|
@ -359,7 +359,7 @@ mod test {
|
|||
ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン";
|
||||
let b = s.as_bytes().to_base64(STANDARD);
|
||||
bh.iter(|| {
|
||||
b.from_base64();
|
||||
b.from_base64().unwrap();
|
||||
});
|
||||
bh.bytes = b.len() as u64;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ mod tests {
|
|||
ウヰノオクヤマ ケフコエテ アサキユメミシ ヱヒモセスン";
|
||||
let b = s.as_bytes().to_hex();
|
||||
bh.iter(|| {
|
||||
b.from_hex();
|
||||
b.from_hex().unwrap();
|
||||
});
|
||||
bh.bytes = b.len() as u64;
|
||||
}
|
||||
|
|
|
@ -456,11 +456,11 @@ mod tests {
|
|||
|
||||
let mut w = io::stdout();
|
||||
let w = &mut w as &mut io::Writer;
|
||||
write!(w, "\n");
|
||||
write_5_number_summary(w, &summ2);
|
||||
write!(w, "\n");
|
||||
write_boxplot(w, &summ2, 50);
|
||||
write!(w, "\n");
|
||||
(write!(w, "\n")).unwrap();
|
||||
write_5_number_summary(w, &summ2).unwrap();
|
||||
(write!(w, "\n")).unwrap();
|
||||
write_boxplot(w, &summ2, 50).unwrap();
|
||||
(write!(w, "\n")).unwrap();
|
||||
|
||||
assert_eq!(summ.sum, summ2.sum);
|
||||
assert_eq!(summ.min, summ2.min);
|
||||
|
@ -1003,7 +1003,7 @@ mod tests {
|
|||
fn t(s: &Summary, expected: ~str) {
|
||||
use std::io::MemWriter;
|
||||
let mut m = MemWriter::new();
|
||||
write_boxplot(&mut m as &mut io::Writer, s, 30);
|
||||
write_boxplot(&mut m as &mut io::Writer, s, 30).unwrap();
|
||||
let out = str::from_utf8_owned(m.unwrap()).unwrap();
|
||||
assert_eq!(out, expected);
|
||||
}
|
||||
|
|
|
@ -959,7 +959,7 @@ mod tests {
|
|||
fn test_mutex_cond_no_waiter() {
|
||||
let m = Mutex::new();
|
||||
let m2 = m.clone();
|
||||
task::try(proc() {
|
||||
let _ = task::try(proc() {
|
||||
m.lock_cond(|_x| { })
|
||||
});
|
||||
m2.lock_cond(|cond| {
|
||||
|
|
|
@ -720,7 +720,7 @@ fn should_sort_failures_before_printing_them() {
|
|||
failures: ~[test_b, test_a]
|
||||
};
|
||||
|
||||
st.write_failures();
|
||||
st.write_failures().unwrap();
|
||||
let s = match st.out {
|
||||
Raw(ref m) => str::from_utf8(m.get_ref()).unwrap(),
|
||||
Pretty(_) => unreachable!()
|
||||
|
@ -1485,7 +1485,7 @@ mod tests {
|
|||
m2.insert_metric("runtime", 1100.0, 2.0);
|
||||
m2.insert_metric("throughput", 50.0, 2.0);
|
||||
|
||||
m1.save(&pth);
|
||||
m1.save(&pth).unwrap();
|
||||
|
||||
// Ask for a ratchet that should fail to advance.
|
||||
let (diff1, ok1) = m2.ratchet(&pth, None);
|
||||
|
|
|
@ -821,7 +821,7 @@ mod bench {
|
|||
pub fn parse_str(bh: &mut BenchHarness) {
|
||||
let s = "urn:uuid:F9168C5E-CEB2-4faa-B6BF-329BF39FA1E4";
|
||||
bh.iter(|| {
|
||||
Uuid::parse_string(s);
|
||||
Uuid::parse_string(s).unwrap();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -473,13 +473,13 @@ fn test() {
|
|||
fn make_path(filename: ~str) -> Path {
|
||||
let pth = os::self_exe_path().expect("workcache::test failed").with_filename(filename);
|
||||
if pth.exists() {
|
||||
fs::unlink(&pth);
|
||||
fs::unlink(&pth).unwrap();
|
||||
}
|
||||
return pth;
|
||||
}
|
||||
|
||||
let pth = make_path(~"foo.c");
|
||||
File::create(&pth).write(bytes!("int main() { return 0; }"));
|
||||
File::create(&pth).write(bytes!("int main() { return 0; }")).unwrap();
|
||||
|
||||
let db_path = make_path(~"db.json");
|
||||
|
||||
|
@ -491,7 +491,8 @@ fn test() {
|
|||
let subcx = cx.clone();
|
||||
let pth = pth.clone();
|
||||
|
||||
let file_content = from_utf8_owned(File::open(&pth).read_to_end()).unwrap();
|
||||
let contents = File::open(&pth).read_to_end().unwrap();
|
||||
let file_content = from_utf8_owned(contents).unwrap();
|
||||
|
||||
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||
prep.declare_input("file", pth.as_str().unwrap(), file_content);
|
||||
|
@ -500,7 +501,7 @@ fn test() {
|
|||
// FIXME (#9639): This needs to handle non-utf8 paths
|
||||
run::process_status("gcc", [pth.as_str().unwrap().to_owned(),
|
||||
~"-o",
|
||||
out.as_str().unwrap().to_owned()]);
|
||||
out.as_str().unwrap().to_owned()]).unwrap();
|
||||
|
||||
let _proof_of_concept = subcx.prep("subfn");
|
||||
// Could run sub-rules inside here.
|
||||
|
|
|
@ -106,7 +106,7 @@ fn test_get_dbpath_for_term() {
|
|||
#[test]
|
||||
#[ignore(reason = "see test_get_dbpath_for_term")]
|
||||
fn test_open() {
|
||||
open("screen");
|
||||
open("screen").unwrap();
|
||||
let t = open("nonexistent terminal that hopefully does not exist");
|
||||
assert!(t.is_err());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue