mirror of
https://github.com/google/googletest.git
synced 2026-10-28 18:07:18 +08:00
Merge pull request #5082 from Muszic:fix-json-utf8-output
PiperOrigin-RevId: 978191552 Change-Id: I2744f219171a97622333f7b84aa76f78dd63e975
This commit is contained in:
commit
7e91a413e8
@ -4648,7 +4648,7 @@ std::string JsonUnitTestResultPrinter::EscapeJson(const std::string& str) {
|
||||
m << "\\r";
|
||||
break;
|
||||
default:
|
||||
if (ch < ' ') {
|
||||
if (static_cast<unsigned char>(ch) < ' ' || ch == '\x7F') {
|
||||
m << "\\u00" << String::FormatByte(static_cast<unsigned char>(ch));
|
||||
} else {
|
||||
m << ch;
|
||||
|
||||
@ -336,7 +336,7 @@ EXPECTED_NON_EMPTY = {
|
||||
'time': '*',
|
||||
'timestamp': '*',
|
||||
'classname': 'PropertyRecordingTest',
|
||||
'key_1': '1',
|
||||
'key_1': '\u007f!caf\u00e9 \u4e2d',
|
||||
},
|
||||
{
|
||||
'name': 'IntValuedProperty',
|
||||
@ -878,7 +878,7 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase):
|
||||
'the expected exit code %s.'
|
||||
% (command, p.exit_code, expected_exit_code),
|
||||
)
|
||||
with open(json_path) as f:
|
||||
with open(json_path, encoding='utf-8') as f:
|
||||
actual = json.load(f)
|
||||
return actual
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ It is good practice to tell why you skip a test.
|
||||
</properties>
|
||||
<testcase name="OneProperty" file="gtest_xml_output_unittest_.cc" line="125" status="run" result="completed" time="*" timestamp="*" classname="PropertyRecordingTest">
|
||||
<properties>
|
||||
<property name="key_1" value="1"/>
|
||||
<property name="key_1" value="\u007f!caf\u00e9 \u4e2d"/>
|
||||
</properties>
|
||||
</testcase>
|
||||
<testcase name="IntValuedProperty" file="gtest_xml_output_unittest_.cc" line="129" status="run" result="completed" time="*" timestamp="*" classname="PropertyRecordingTest">
|
||||
|
||||
@ -123,7 +123,7 @@ class PropertyRecordingTest : public Test {
|
||||
};
|
||||
|
||||
TEST_F(PropertyRecordingTest, OneProperty) {
|
||||
RecordProperty("key_1", "1");
|
||||
RecordProperty("key_1", "\x7F!caf\xC3\xA9 \xE4\xB8\xAD");
|
||||
}
|
||||
|
||||
TEST_F(PropertyRecordingTest, IntValuedProperty) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user