Skip to content

Commit

Permalink
Narrowing down where the unicode encoding issue is for #545
Browse files Browse the repository at this point in the history
  • Loading branch information
belav committed Jan 18, 2022
1 parent 3bdd402 commit 8febabf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Src/CSharpier.Cli.Tests/CliTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public async Task Should_Format_Piped_File(string lineEnding)
result.ExitCode.Should().Be(0);
}

[Test]
public async Task Should_Format_Unicode()
{
// use the \u so that we don't accidentally reform this file to be '?'
var unicodeContent = $"var test = '{'\u3002'}';\n";

var result = await new CsharpierProcess().WithPipedInput(unicodeContent).ExecuteAsync();

result.Output.Should().Be(unicodeContent);
result.ExitCode.Should().Be(0);
}

[Test]
public async Task Should_Print_NotFound()
{
Expand Down
12 changes: 12 additions & 0 deletions Src/CSharpier.Tests/CommandLineFormatterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,18 @@ public void Should_Format_StandardInput_When_Provided()
result.Lines.First().Should().Be(FormattedClassContent);
}

[Test]
public void Should_Format_Unicode_StandardInput()
{
var unicodeContent = $"var test = '{'\u3002'}';\n";

var context = new TestContext();
var result = this.Format(context, standardInFileContents: unicodeContent);

result.Lines.Should().ContainSingle();
result.Lines.First().Should().Be(unicodeContent);
}

[Test]
public void File_With_Mismatched_Line_Endings_In_Verbatim_String_Should_Pass_Validation()
{
Expand Down

0 comments on commit 8febabf

Please sign in to comment.