Skip to content

Commit 6759bb0

Browse files
Merge pull request #646 from ds5678/update-testing-framework-for-csharp
Update testing framework
2 parents 9812081 + 9951a02 commit 6759bb0

File tree

19 files changed

+1222
-9303
lines changed

19 files changed

+1222
-9303
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationCSharpTest.cs

Lines changed: 579 additions & 0 deletions
Large diffs are not rendered by default.

tests/ClangSharp.PInvokeGenerator.UnitTests/Base/CXXMethodDeclarationTest.cs

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public abstract class CXXMethodDeclarationTest : PInvokeGeneratorTest
2525
[Test]
2626
public Task InstanceTest() => InstanceTestImpl();
2727

28+
[Test]
29+
public Task MacrosExpansionTest() => MacrosExpansionTestImpl();
30+
2831
[Test]
2932
public Task MemberCallTest() => MemberCallTestImpl();
3033

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

67-
[Test]
68-
public virtual Task MacrosExpansionTest()
69-
{
70-
var inputContents = @"typedef struct
71-
{
72-
unsigned char *buf;
73-
int size;
74-
} context_t;
75-
76-
int buf_close(void *pContext)
77-
{
78-
((context_t*)pContext)->buf=0;
79-
return 0;
80-
}
81-
";
82-
83-
var expectedOutputContents = @"namespace ClangSharp.Test
84-
{
85-
public unsafe partial struct context_t
86-
{
87-
[NativeTypeName(""unsigned char *"")]
88-
public byte* buf;
89-
90-
public int size;
91-
}
92-
93-
public static unsafe partial class Methods
94-
{
95-
public static int buf_close(void* pContext)
96-
{
97-
((context_t*)(pContext))->buf = null;
98-
return 0;
99-
}
100-
}
101-
}
102-
";
103-
104-
return ValidateBindingsAsync(inputContents, expectedOutputContents);
105-
}
106-
10770
protected abstract Task ConstructorTestImpl();
10871

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

11780
protected abstract Task InstanceTestImpl();
11881

82+
protected abstract Task MacrosExpansionTestImpl();
83+
11984
protected abstract Task MemberCallTestImpl();
12085

12186
protected abstract Task MemberTestImpl();

0 commit comments

Comments
 (0)