Skip to content

Commit

Permalink
Enable UTF Output for new test framework discoveryy and execution to …
Browse files Browse the repository at this point in the history
…fix GB18030 bug
  • Loading branch information
DavidARaygoza committed Aug 8, 2024
1 parent 00f4232 commit 077895c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions GoogleTestAdapter/Core/GoogleTestConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class GoogleTestConstants
public const string NrOfRepetitionsOption = " --gtest_repeat";
public const string CatchExceptions = " --gtest_catch_exceptions";
public const string BreakOnFailure = " --gtest_break_on_failure";
public const string Utf8OutputOption = " --gtest_print_utf8=1";

public const int ShuffleTestsSeedDefaultValue = 0;
public const string ShuffleTestsSeedMaxValueAsString = "99999";
Expand Down
2 changes: 1 addition & 1 deletion GoogleTestAdapter/Core/Runners/CommandLineGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CommandLineGenerator
public class Args
{
public IList<TestCase> TestCases { get; }
public string CommandLine { get; }
public string CommandLine { get; set; }

internal Args(IList<TestCase> testCases, string commandLine)
{
Expand Down
4 changes: 4 additions & 0 deletions GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ private void RunTestsFromExecutable(string executable, string workingDir, IDicti
{
break;
}

// Enable UTF-8 output for Google Test.
arguments.CommandLine += " --gtest_print_utf8=1";

var streamingParser = new StreamingStandardOutputTestResultParser(arguments.TestCases, _logger, _frameworkReporter);
var results = RunTests(executable, workingDir, envVars, isBeingDebugged, debuggedLauncher, arguments, executor, streamingParser).ToArray();

Expand Down
2 changes: 1 addition & 1 deletion GoogleTestAdapter/Core/TestCases/TestCaseFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private IList<TestCase> NewCreateTestcases(Action<TestCase> reportTestCase, List
parser.ReportLine(s);
};

string cmdLine = GoogleTestConstants.ListTestsOption;
string cmdLine = GoogleTestConstants.ListTestsOption + GoogleTestConstants.Utf8OutputOption;
if (!string.IsNullOrEmpty(_settings.AdditionalTestDiscoveryParam))
{
cmdLine = string.Format("{0} {1}", _settings.AdditionalTestDiscoveryParam, cmdLine);
Expand Down

0 comments on commit 077895c

Please sign in to comment.