Skip to content

Commit

Permalink
Fix the C test on Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Aug 4, 2021
1 parent cef083f commit 49f1a7f
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/ClangSharp.PInvokeGenerator.UnitTests/CTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft and Contributors. All rights reserved. Licensed under the University of Illinois/NCSA Open Source License. See LICENSE.txt in the project root for license information.

using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Xunit;

Expand All @@ -20,8 +21,11 @@ public Task BasicTest()
enum_t _field;
} struct_t;
";
string expectedOutputContents;

var expectedOutputContents = @"namespace ClangSharp.Test
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
expectedOutputContents = @"namespace ClangSharp.Test
{
public enum MyEnum
{
Expand All @@ -37,6 +41,27 @@ public partial struct MyStruct
}
}
";
}
else
{
expectedOutputContents = @"namespace ClangSharp.Test
{
[NativeTypeName(""unsigned int"")]
public enum MyEnum : uint
{
MyEnum_Value0,
MyEnum_Value1,
MyEnum_Value2,
}
public partial struct MyStruct
{
[NativeTypeName(""enum_t"")]
public MyEnum _field;
}
}
";
}

return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, commandlineArgs: DefaultCClangCommandLineArgs);
}
Expand Down

0 comments on commit 49f1a7f

Please sign in to comment.