Skip to content

Commit 2863bec

Browse files
Add unit test for --with-attributes option.
1 parent c5a6a76 commit 2863bec

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

tests/ClangSharp.PInvokeGenerator.UnitTests/OptionsTest.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,41 @@ public partial struct StructD
5454

5555
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, withUsings: withUsings);
5656
}
57+
58+
[Test]
59+
public Task WithAttributes()
60+
{
61+
var inputContents = @"struct StructA {}; struct StructB {}; struct StructC {}; struct StructD {};";
62+
var expectedOutputContents =
63+
@"namespace ClangSharp.Test
64+
{
65+
[A]
66+
public partial struct StructA
67+
{
68+
}
69+
70+
[B]
71+
public partial struct StructB
72+
{
73+
}
74+
75+
[Star]
76+
public partial struct StructC
77+
{
78+
}
79+
80+
[Star]
81+
public partial struct StructD
82+
{
83+
}
84+
}
85+
";
86+
var withAttributes = new Dictionary<string, IReadOnlyList<string>> {
87+
["StructA"] = [@"A"],
88+
["StructB"] = [@"B"],
89+
["*"] = [@"Star"],
90+
};
91+
92+
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, withAttributes: withAttributes);
93+
}
5794
}

0 commit comments

Comments
 (0)