Skip to content

Commit 36ea325

Browse files
authored
Add CLR test for lib validation (#2403)
1 parent e03d14e commit 36ea325

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

crates/tests/lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ features = [
1212
"Win32_Graphics_Direct3D11",
1313
"Win32_Graphics_Gdi",
1414
"Win32_System_Threading",
15+
"Win32_System_ClrHosting",
1516
]
1617

1718
[dependencies.windows-sys]

crates/tests/lib/tests/win.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use windows::{core::*, Win32::Graphics::Direct3D::Fxc::*, Win32::Graphics::Gdi::*, Win32::System::Threading::*};
1+
use windows::{core::*, Win32::Graphics::Direct3D::Fxc::*, Win32::Graphics::Gdi::*, Win32::System::ClrHosting::*, Win32::System::Threading::*};
22

33
#[test]
44
fn linker() -> Result<()> {
@@ -21,3 +21,15 @@ fn wait_on_address() {
2121
WaitOnAddress(std::ptr::null(), std::ptr::null(), 0, 0);
2222
}
2323
}
24+
25+
#[test]
26+
fn clr() -> Result<()> {
27+
unsafe {
28+
let mut version = vec![0; 20];
29+
let mut len = 0;
30+
GetFileVersion(w!("../../libs/metadata/default/Windows.winmd"), Some(&mut version), &mut len)?;
31+
let version = String::from_utf16_lossy(&version[..len as usize - 1]);
32+
assert_eq!(version, "WindowsRuntime 1.4");
33+
Ok(())
34+
}
35+
}

0 commit comments

Comments
 (0)