From dd82358a04edcb40f72c599f8bd7340094ac2c0a Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Sun, 12 Mar 2017 14:52:17 +0200 Subject: [PATCH] Always upper-cased the first character of a function. Signed-off-by: Dimitar Dobrev --- src/Generator/Passes/RenamePass.cs | 4 ++-- tests/Common/Common.Tests.cs | 1 + tests/Common/Common.cpp | 4 ++++ tests/Common/Common.h | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Generator/Passes/RenamePass.cs b/src/Generator/Passes/RenamePass.cs index 27c5a61c..0975b8cb 100644 --- a/src/Generator/Passes/RenamePass.cs +++ b/src/Generator/Passes/RenamePass.cs @@ -354,8 +354,8 @@ namespace CppSharp.Passes switch (pattern) { case RenameCasePattern.UpperCamelCase: - // ensure separation by not ending up with more capitals in a row than before - if (sb.Length == 1 || !char.IsUpper(sb[1])) + // ensure separation in enum items by not ending up with more capitals in a row than before + if (sb.Length == 1 || !char.IsUpper(sb[1]) || !(decl is Enumeration.Item)) sb[0] = char.ToUpperInvariant(sb[0]); if (@class != null && @class.Type == ClassType.Interface) sb[1] = char.ToUpperInvariant(sb[1]); diff --git a/tests/Common/Common.Tests.cs b/tests/Common/Common.Tests.cs index e098a196..30049391 100644 --- a/tests/Common/Common.Tests.cs +++ b/tests/Common/Common.Tests.cs @@ -42,6 +42,7 @@ public class CommonTests : GeneratorTestFixture e = EnumWithUnderscores.CAPITALS_More; e = EnumWithUnderscores.UsesDigits1_0; e.GetHashCode(); + Common.SMallFollowedByCapital(); #pragma warning restore 0168 #pragma warning restore 0219 diff --git a/tests/Common/Common.cpp b/tests/Common/Common.cpp index 7fd6334d..cb6c48fe 100644 --- a/tests/Common/Common.cpp +++ b/tests/Common/Common.cpp @@ -660,3 +660,7 @@ void hasPointerParam(Foo* foo, int i) void hasPointerParam(const Foo& foo) { } + +void sMallFollowedByCapital() +{ +} diff --git a/tests/Common/Common.h b/tests/Common/Common.h index b3013aba..b0dfff6a 100644 --- a/tests/Common/Common.h +++ b/tests/Common/Common.h @@ -1220,3 +1220,5 @@ DLL_API void hasPointerParam(const Foo& foo); enum EmptyEnum { }; enum __enum_with_underscores { lOWER_BEFORE_CAPITAL, CAPITALS_More, underscore_at_end_, usesDigits1_0 }; + +void DLL_API sMallFollowedByCapital();