-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Translate upstream libclang unit tests
- Loading branch information
Showing
5 changed files
with
436 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" /> | ||
<PackageReference Include="xunit" Version="2.3.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" /> | ||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ClangSharp\ClangSharp.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,34 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
using Xunit; | ||
|
||
namespace ClangSharp.Test | ||
{ | ||
public class ModuleMapDescriptor | ||
{ | ||
[Fact] | ||
public void Basic() | ||
{ | ||
var contents = | ||
"framework module TestFrame {\n" | ||
+ " umbrella header \"TestFrame.h\"\n" | ||
+ "\n" | ||
+ " export *\n" | ||
+ " module * { export * }\n" | ||
+ "}\n"; | ||
|
||
CXModuleMapDescriptor mmd = clang.ModuleMapDescriptor_create(0); | ||
|
||
clang.ModuleMapDescriptor_setFrameworkModuleName(mmd, "TestFrame"); | ||
clang.ModuleMapDescriptor_setUmbrellaHeader(mmd, "TestFrame.h"); | ||
|
||
IntPtr bufPtr; | ||
uint bufSize = 0; | ||
clang.ModuleMapDescriptor_writeToBuffer(mmd, 0, out bufPtr, out bufSize); | ||
var bufStr = Marshal.PtrToStringAnsi(bufPtr, (int)bufSize); | ||
Assert.Equal(contents, bufStr); | ||
clang.free(bufPtr); | ||
clang.ModuleMapDescriptor_dispose(mmd); | ||
} | ||
} | ||
} |
Oops, something went wrong.