about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorJethro Beekman <jethro@jbeekman.nl>2017-05-03 10:24:49 -0700
committerJethro Beekman <jethro@jbeekman.nl>2017-05-11 09:47:02 -0700
commit71de9dbe5bc823a9603318c9cf92f58d7f5eb6f9 (patch)
tree722155987001a9fd9aa5cdbd86206a65a00db2f9 /src/libstd/sys/windows
parent70c267fc91eddcfa47b5f6be65f8ec01d86edbe3 (diff)
downloadrust-71de9dbe5bc823a9603318c9cf92f58d7f5eb6f9.tar.gz
rust-71de9dbe5bc823a9603318c9cf92f58d7f5eb6f9.zip
Add test
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/os.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 402d4f9ee6e..a51b458451e 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -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"));
+    }
+}