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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

using System.Threading.Tasks;
using ClangSharp.UnitTests.Baseline;
using NUnit.Framework;

namespace ClangSharp.UnitTests;
Expand All @@ -12,8 +13,10 @@ namespace ClangSharp.UnitTests;
/// rather than the non-existent <c>__AnonymousEnum_*</c> enum name.
/// </summary>
[Platform("win")]
public sealed class AnonymousEnumReferenceExcludeUsingStaticsTest : PInvokeGeneratorTest
public sealed class AnonymousEnumReferenceExcludeUsingStaticsTest : StandaloneBaselineTest
{
protected override string Area => "AnonymousEnumReferenceExcludeUsingStatics";

[Test]
public Task ReferenceIsQualifiedWithBackingClass()
{
Expand All @@ -26,23 +29,9 @@ enum MyEnum2 : int
{
MyEnum2_Value1 = MyEnum1_Value1,
};
";

var expectedOutputContents = @"namespace ClangSharp.Test
{
public enum MyEnum2
{
MyEnum2_Value1 = Methods.MyEnum1_Value1,
}

public static partial class Methods
{
public const int MyEnum1_Value1 = 1;
}
}
";

var diagnostics = new[] { new Diagnostic(DiagnosticLevel.Info, "Found anonymous enum: __AnonymousEnum_ClangUnsavedFile_L1_C1. Mapping values as constants in: Methods", "Line 1, Column 1 in ClangUnsavedFile.h") };
return ValidateGeneratedCSharpLatestWindowsBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorConfigurationOptions.DontUseUsingStaticsForEnums, expectedDiagnostics: diagnostics);
return ValidateGeneratedCSharpLatestWindowsBaselineAsync(inputContents, PInvokeGeneratorConfigurationOptions.DontUseUsingStaticsForEnums, expectedDiagnostics: diagnostics);
}
}
Loading
Loading