Skip to content

Commit

Permalink
Add test for multiple spaces, remove unneeded regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AKTheKnight committed Mar 5, 2019
1 parent 1e7c1b7 commit 3740384
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Humanizer.Tests.Shared/InflectorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public void Hyphenate(string input, string expectedOutput)
[InlineData("customer_first_name", "CustomerFirstName")]
[InlineData("customer_first_name goes here", "CustomerFirstNameGoesHere")]
[InlineData("customer name", "CustomerName")]
[InlineData("customer name", "CustomerName")]
public void Pascalize(string input, string expectedOutput)
{
Assert.Equal(expectedOutput, input.Pascalize());
Expand All @@ -116,6 +117,7 @@ public void Pascalize(string input, string expectedOutput)
[InlineData("customer_first_name", "customerFirstName")]
[InlineData("customer_first_name goes here", "customerFirstNameGoesHere")]
[InlineData("customer name", "customerName")]
[InlineData("customer name", "customerName")]
[InlineData("", "")]
public void Camelize(string input, string expectedOutput)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Humanizer/InflectorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public static string Titleize(this string input)
public static string Pascalize(this string input)
{

input = Regex.Replace(input, "(?:^|_| )(.)", match => match.Groups[1].Value.ToUpper());
return Regex.Replace(input, "(?:^|_| )(.)", match => match.Groups[1].Value.ToUpper());

return Regex.Replace(input, @"\s+", "");
//return Regex.Replace(input, @"\s+", "");
}

/// <summary>
Expand Down

0 comments on commit 3740384

Please sign in to comment.