Skip to content

Commit

Permalink
Merge bc09728 into b395975
Browse files Browse the repository at this point in the history
  • Loading branch information
TheStormN committed Jun 11, 2020
2 parents b395975 + bc09728 commit 6d6429c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test_lib_json/main.cpp
Expand Up @@ -2702,6 +2702,34 @@ JSONTEST_FIXTURE_LOCAL(StreamWriterTest, escapeControlCharacters) {
}
}

#ifdef _WIN32
JSONTEST_FIXTURE_LOCAL(StreamWriterTest, tabCharacterWinTest) {
// Get the current locale before changing it
std::string currentLocale = setlocale(LC_ALL, NULL);
setlocale(LC_ALL, "English_United States.1252");

Json::Value root;
root["test"] = "\tTabTesting\t";

Json::StreamWriterBuilder b;

JSONTEST_ASSERT(Json::writeString(b, root) == "{\n\t\"test\" : "
"\"\\tTabTesting\\t\"\n}");

b.settings_["emitUTF8"] = true;
JSONTEST_ASSERT(Json::writeString(b, root) == "{\n\t\"test\" : "
"\"\\tTabTesting\\t\"\n}");

b.settings_["emitUTF8"] = false;
JSONTEST_ASSERT(Json::writeString(b, root) == "{\n\t\"test\" : "
"\"\\tTabTesting\\t\"\n}");

// Restore the locale
if (!currentLocale.empty())
setlocale(LC_ALL, currentLocale.c_str());
}
#endif

struct ReaderTest : JsonTest::TestCase {
void setStrictMode() {
reader = std::unique_ptr<Json::Reader>(
Expand Down

0 comments on commit 6d6429c

Please sign in to comment.