]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/windows/os.rs
Add test
[rust.git] / src / libstd / sys / windows / os.rs
index 402d4f9ee6e56b6dee75e1144fde3191e671a0fb..a51b458451e8623ff3fd397956f276cf6e5e4604 100644 (file)
@@ -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"));
+    }
+}