Skip to content

Commit cd94e91

Browse files
committed
std: cleanup os and str tests
1 parent dca9ff9 commit cd94e91

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/libstd/os.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,39 +1934,39 @@ mod tests {
19341934
#[test]
19351935
fn copy_file_ok() {
19361936
unsafe {
1937-
let tempdir = getcwd(); // would like to use $TMPDIR,
1938-
// doesn't seem to work on Linux
1939-
assert!((tempdir.to_str().len() > 0u));
1940-
let input = tempdir.push("in.txt");
1941-
let out = tempdir.push("out.txt");
1937+
let tempdir = getcwd(); // would like to use $TMPDIR,
1938+
// doesn't seem to work on Linux
1939+
assert!((tempdir.to_str().len() > 0u));
1940+
let input = tempdir.push("in.txt");
1941+
let out = tempdir.push("out.txt");
19421942

1943-
/* Write the temp input file */
1943+
/* Write the temp input file */
19441944
let ostream = do input.to_str().as_c_str |fromp| {
19451945
do "w+b".as_c_str |modebuf| {
19461946
libc::fopen(fromp, modebuf)
19471947
}
1948-
};
1949-
assert!((ostream as uint != 0u));
1950-
let s = ~"hello";
1951-
let mut buf = s.to_owned().to_c_str();
1952-
let len = buf.len();
1953-
do buf.as_mut_buf |b, _len| {
1954-
assert_eq!(libc::fwrite(b as *c_void, 1u as size_t,
1955-
(s.len() + 1u) as size_t, ostream),
1956-
len as size_t)
1957-
}
1958-
assert_eq!(libc::fclose(ostream), (0u as c_int));
1959-
let in_mode = input.get_mode();
1960-
let rs = os::copy_file(&input, &out);
1961-
if (!os::path_exists(&input)) {
1962-
fail!("%s doesn't exist", input.to_str());
1963-
}
1964-
assert!((rs));
1965-
let rslt = run::process_status("diff", [input.to_str(), out.to_str()]);
1966-
assert_eq!(rslt, 0);
1967-
assert_eq!(out.get_mode(), in_mode);
1968-
assert!((remove_file(&input)));
1969-
assert!((remove_file(&out)));
1948+
};
1949+
assert!((ostream as uint != 0u));
1950+
let s = ~"hello";
1951+
let mut buf = s.to_owned().to_c_str();
1952+
let len = buf.len();
1953+
do buf.as_mut_buf |b, _len| {
1954+
assert_eq!(libc::fwrite(b as *c_void, 1u as size_t,
1955+
(s.len() + 1u) as size_t, ostream),
1956+
len as size_t)
1957+
}
1958+
assert_eq!(libc::fclose(ostream), (0u as c_int));
1959+
let in_mode = input.get_mode();
1960+
let rs = os::copy_file(&input, &out);
1961+
if (!os::path_exists(&input)) {
1962+
fail!("%s doesn't exist", input.to_str());
1963+
}
1964+
assert!((rs));
1965+
let rslt = run::process_status("diff", [input.to_str(), out.to_str()]);
1966+
assert_eq!(rslt, 0);
1967+
assert_eq!(out.get_mode(), in_mode);
1968+
assert!((remove_file(&input)));
1969+
assert!((remove_file(&out)));
19701970
}
19711971
}
19721972

0 commit comments

Comments
 (0)