Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jethro Beekman committed May 11, 2017
1 parent 70c267f commit 71de9db
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/libstd/sys/windows/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,17 @@ pub fn home_dir() -> Option<PathBuf> {
pub fn exit(code: i32) -> ! {
unsafe { c::ExitProcess(code as c::UINT) }
}

#[cfg(test)]
mod tests {
use io::Error;
use sys::c;

// tests `error_string` above
#[test]
fn ntstatus_error() {
const STATUS_UNSUCCESSFUL: u32 = 0xc000_0001;
assert!(!Error::from_raw_os_error((STATUS_UNSUCCESSFUL | c::FACILITY_NT_BIT) as _)
.to_string().contains("FormatMessageW() returned error"));
}
}

0 comments on commit 71de9db

Please sign in to comment.