Skip to content

Commit

Permalink
Add unit test for --with-attributes option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldvanmanen committed Jul 30, 2024
1 parent 4d07e05 commit f638981
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/ClangSharp.PInvokeGenerator.UnitTests/OptionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,41 @@ public partial struct StructD

return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, withUsings: withUsings);
}

[Test]
public Task WithAttributes()
{
var inputContents = @"struct StructA {}; struct StructB {}; struct StructC {}; struct StructD {};";
var expectedOutputContents =
@"namespace ClangSharp.Test
{
[A]
public partial struct StructA
{
}
[B]
public partial struct StructB
{
}
[Star]
public partial struct StructC
{
}
[Star]
public partial struct StructD
{
}
}
";
var withAttributes = new Dictionary<string, IReadOnlyList<string>> {
["StructA"] = [@"A"],
["StructB"] = [@"B"],
["*"] = [@"Star"],
};

return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, withAttributes: withAttributes);
}
}

0 comments on commit f638981

Please sign in to comment.