Skip to content

Commit

Permalink
Add CLR test for lib validation (#2403)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Mar 28, 2023
1 parent e03d14e commit 36ea325
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/tests/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ features = [
"Win32_Graphics_Direct3D11",
"Win32_Graphics_Gdi",
"Win32_System_Threading",
"Win32_System_ClrHosting",
]

[dependencies.windows-sys]
Expand Down
14 changes: 13 additions & 1 deletion crates/tests/lib/tests/win.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use windows::{core::*, Win32::Graphics::Direct3D::Fxc::*, Win32::Graphics::Gdi::*, Win32::System::Threading::*};
use windows::{core::*, Win32::Graphics::Direct3D::Fxc::*, Win32::Graphics::Gdi::*, Win32::System::ClrHosting::*, Win32::System::Threading::*};

#[test]
fn linker() -> Result<()> {
Expand All @@ -21,3 +21,15 @@ fn wait_on_address() {
WaitOnAddress(std::ptr::null(), std::ptr::null(), 0, 0);
}
}

#[test]
fn clr() -> Result<()> {
unsafe {
let mut version = vec![0; 20];
let mut len = 0;
GetFileVersion(w!("../../libs/metadata/default/Windows.winmd"), Some(&mut version), &mut len)?;
let version = String::from_utf16_lossy(&version[..len as usize - 1]);
assert_eq!(version, "WindowsRuntime 1.4");
Ok(())
}
}

0 comments on commit 36ea325

Please sign in to comment.