Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public abstract class CXXMethodDeclarationTest : PInvokeGeneratorTest
[Test]
public Task InstanceTest() => InstanceTestImpl();

[Test]
public Task MacrosExpansionTest() => MacrosExpansionTestImpl();

[Test]
public Task MemberCallTest() => MemberCallTestImpl();

Expand Down Expand Up @@ -64,46 +67,6 @@ public abstract class CXXMethodDeclarationTest : PInvokeGeneratorTest
[Test]
public Task VirtualWithVtblIndexAttributeTest() => VirtualWithVtblIndexAttributeTestImpl();

[Test]
public virtual Task MacrosExpansionTest()
{
var inputContents = @"typedef struct
{
unsigned char *buf;
int size;
} context_t;

int buf_close(void *pContext)
{
((context_t*)pContext)->buf=0;
return 0;
}
";

var expectedOutputContents = @"namespace ClangSharp.Test
{
public unsafe partial struct context_t
{
[NativeTypeName(""unsigned char *"")]
public byte* buf;

public int size;
}

public static unsafe partial class Methods
{
public static int buf_close(void* pContext)
{
((context_t*)(pContext))->buf = null;
return 0;
}
}
}
";

return ValidateBindingsAsync(inputContents, expectedOutputContents);
}

protected abstract Task ConstructorTestImpl();

protected abstract Task ConstructorWithInitializeTestImpl();
Expand All @@ -116,6 +79,8 @@ public static int buf_close(void* pContext)

protected abstract Task InstanceTestImpl();

protected abstract Task MacrosExpansionTestImpl();

protected abstract Task MemberCallTestImpl();

protected abstract Task MemberTestImpl();
Expand Down
Loading