-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support getInterfaceID for IActivationFactory (#62)
- Loading branch information
1 parent
2079017
commit e995795
Showing
3 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import DotNetMetadata | ||
import XCTest | ||
import WindowsMetadata | ||
|
||
final class InterfaceIDTests: XCTestCase { | ||
internal static var context: WinMDLoadContext! | ||
internal static var mscorlib: Assembly! | ||
|
||
override func setUpWithError() throws { | ||
if Self.mscorlib == nil { | ||
Self.context = WinMDLoadContext() | ||
|
||
// Expect mscorlib.winmd side-by-side with the test executable | ||
let mscorlibURL = Bundle.main.bundleURL.appendingPathComponent("mscorlib.winmd", isDirectory: false) | ||
Self.mscorlib = try Self.context.load(url: mscorlibURL) | ||
} | ||
} | ||
|
||
/// Test that we can get the interface ID for `IActivationFactory`, | ||
/// which lives in the core library rather than a Windows Metadata file, | ||
/// so uses System's GuidAttribute, not Windows.Foundation's. | ||
public func testCoreLibraryIActivationFactory() throws { | ||
let typeDefinition = try XCTUnwrap(Self.mscorlib.resolveTypeDefinition( | ||
namespace: "System.Runtime.InteropServices.WindowsRuntime", name: "IActivationFactory")) | ||
XCTAssertEqual( | ||
try getInterfaceID(typeDefinition), | ||
UUID(uuidString: "00000035-0000-0000-c000-000000000046")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters