convert JSONCPP_STRING etc from macros to typedefs

This commit is contained in:
Billy Donahue
2019-01-17 16:35:29 -05:00
parent 6e7cbf8f54
commit 1c2ed7a10f
14 changed files with 416 additions and 444 deletions

View File

@@ -80,7 +80,7 @@ TestResult::TestResult() {
predicateStackTail_ = &rootPredicateNode_;
}
void TestResult::setTestName(const JSONCPP_STRING& name) { name_ = name; }
void TestResult::setTestName(const Json::String& name) { name_ = name; }
TestResult&
TestResult::addFailure(const char* file, unsigned int line, const char* expr) {
@@ -150,7 +150,7 @@ void TestResult::printFailure(bool printTestName) const {
// Print in reverse to display the callstack in the right order
for (const auto& failure : failures_) {
JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
Json::String indent(failure.nestingLevel_ * 2, ' ');
if (failure.file_) {
printf("%s%s(%u): ", indent.c_str(), failure.file_, failure.line_);
}
@@ -160,19 +160,18 @@ void TestResult::printFailure(bool printTestName) const {
printf("\n");
}
if (!failure.message_.empty()) {
JSONCPP_STRING reindented = indentText(failure.message_, indent + " ");
Json::String reindented = indentText(failure.message_, indent + " ");
printf("%s\n", reindented.c_str());
}
}
}
JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text,
const JSONCPP_STRING& indent) {
JSONCPP_STRING reindented;
JSONCPP_STRING::size_type lastIndex = 0;
Json::String TestResult::indentText(const Json::String& text, const Json::String& indent) {
Json::String reindented;
Json::String::size_type lastIndex = 0;
while (lastIndex < text.size()) {
JSONCPP_STRING::size_type nextIndex = text.find('\n', lastIndex);
if (nextIndex == JSONCPP_STRING::npos) {
Json::String::size_type nextIndex = text.find('\n', lastIndex);
if (nextIndex == Json::String::npos) {
nextIndex = text.size() - 1;
}
reindented += indent;
@@ -182,7 +181,7 @@ JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text,
return reindented;
}
TestResult& TestResult::addToLastFailure(const JSONCPP_STRING& message) {
TestResult& TestResult::addToLastFailure(const Json::String& message) {
if (messageTarget_ != nullptr) {
messageTarget_->message_ += message;
}
@@ -225,9 +224,9 @@ Runner& Runner::add(TestCaseFactory factory) {
size_t Runner::testCount() const { return tests_.size(); }
JSONCPP_STRING Runner::testNameAt(size_t index) const {
Json::String Runner::testNameAt(size_t index) const {
TestCase* test = tests_[index]();
JSONCPP_STRING name = test->testName();
Json::String name = test->testName();
delete test;
return name;
}
@@ -284,7 +283,7 @@ bool Runner::runAllTest(bool printSummary) const {
}
}
bool Runner::testIndex(const JSONCPP_STRING& testName, size_t& indexOut) const {
bool Runner::testIndex(const Json::String& testName, size_t& indexOut) const {
const size_t count = testCount();
for (size_t index = 0; index < count; ++index) {
if (testNameAt(index) == testName) {
@@ -303,10 +302,10 @@ void Runner::listTests() const {
}
int Runner::runCommandLine(int argc, const char* argv[]) const {
// typedef std::deque<JSONCPP_STRING> TestNames;
// typedef std::deque<String> TestNames;
Runner subrunner;
for (int index = 1; index < argc; ++index) {
JSONCPP_STRING opt = argv[index];
Json::String opt = argv[index];
if (opt == "--list-tests") {
listTests();
return 0;
@@ -406,21 +405,19 @@ void Runner::printUsage(const char* appName) {
// Assertion functions
// //////////////////////////////////////////////////////////////////
JSONCPP_STRING ToJsonString(const char* toConvert) {
return JSONCPP_STRING(toConvert);
}
Json::String ToJsonString(const char* toConvert) { return Json::String(toConvert); }
JSONCPP_STRING ToJsonString(JSONCPP_STRING in) { return in; }
Json::String ToJsonString(Json::String in) { return in; }
#if JSONCPP_USING_SECURE_MEMORY
JSONCPP_STRING ToJsonString(std::string in) {
return JSONCPP_STRING(in.data(), in.data() + in.length());
Json::String ToJsonString(std::string in) {
return Json::String(in.data(), in.data() + in.length());
}
#endif
TestResult& checkStringEqual(TestResult& result,
const JSONCPP_STRING& expected,
const JSONCPP_STRING& actual,
const Json::String& expected,
const Json::String& actual,
const char* file,
unsigned int line,
const char* expr) {

View File

@@ -32,8 +32,8 @@ class Failure {
public:
const char* file_;
unsigned int line_;
JSONCPP_STRING expr_;
JSONCPP_STRING message_;
Json::String expr_;
Json::String message_;
unsigned int nestingLevel_;
};
@@ -65,7 +65,7 @@ public:
/// \internal Implementation detail for predicate macros
PredicateContext* predicateStackTail_;
void setTestName(const JSONCPP_STRING& name);
void setTestName(const Json::String& name);
/// Adds an assertion failure.
TestResult&
@@ -82,7 +82,7 @@ public:
// Generic operator that will work with anything ostream can deal with.
template <typename T> TestResult& operator<<(const T& value) {
JSONCPP_OSTRINGSTREAM oss;
Json::OStringStream oss;
oss.precision(16);
oss.setf(std::ios_base::floatfield);
oss << value;
@@ -96,18 +96,17 @@ public:
TestResult& operator<<(Json::UInt64 value);
private:
TestResult& addToLastFailure(const JSONCPP_STRING& message);
TestResult& addToLastFailure(const Json::String& message);
/// Adds a failure or a predicate context
void addFailureInfo(const char* file,
unsigned int line,
const char* expr,
unsigned int nestingLevel);
static JSONCPP_STRING indentText(const JSONCPP_STRING& text,
const JSONCPP_STRING& indent);
static Json::String indentText(const Json::String& text, const Json::String& indent);
typedef std::deque<Failure> Failures;
Failures failures_;
JSONCPP_STRING name_;
Json::String name_;
PredicateContext rootPredicateNode_;
PredicateContext::Id lastUsedPredicateId_{ 0 };
/// Failure which is the target of the messages added using operator <<
@@ -154,7 +153,7 @@ public:
size_t testCount() const;
/// Returns the name of the test case at the specified index
JSONCPP_STRING testNameAt(size_t index) const;
Json::String testNameAt(size_t index) const;
/// Runs the test case at the specified index using the specified TestResult
void runTestAt(size_t index, TestResult& result) const;
@@ -167,7 +166,7 @@ private: // prevents copy construction and assignment
private:
void listTests() const;
bool testIndex(const JSONCPP_STRING& testName, size_t& indexOut) const;
bool testIndex(const Json::String& testName, size_t& indexOut) const;
static void preventDialogOnCrash();
private:
@@ -190,15 +189,15 @@ TestResult& checkEqual(TestResult& result,
return result;
}
JSONCPP_STRING ToJsonString(const char* toConvert);
JSONCPP_STRING ToJsonString(JSONCPP_STRING in);
Json::String ToJsonString(const char* toConvert);
Json::String ToJsonString(Json::String in);
#if JSONCPP_USING_SECURE_MEMORY
JSONCPP_STRING ToJsonString(std::string in);
Json::String ToJsonString(std::string in);
#endif
TestResult& checkStringEqual(TestResult& result,
const JSONCPP_STRING& expected,
const JSONCPP_STRING& actual,
const Json::String& expected,
const Json::String& actual,
const char* file,
unsigned int line,
const char* expr);

View File

@@ -110,21 +110,20 @@ struct ValueTest : JsonTest::TestCase {
/// Normalize the representation of floating-point number by stripped leading
/// 0 in exponent.
static JSONCPP_STRING normalizeFloatingPointStr(const JSONCPP_STRING& s);
static Json::String normalizeFloatingPointStr(const Json::String& s);
};
JSONCPP_STRING ValueTest::normalizeFloatingPointStr(const JSONCPP_STRING& s) {
JSONCPP_STRING::size_type index = s.find_last_of("eE");
if (index != JSONCPP_STRING::npos) {
JSONCPP_STRING::size_type hasSign =
Json::String ValueTest::normalizeFloatingPointStr(const Json::String& s) {
Json::String::size_type index = s.find_last_of("eE");
if (index != Json::String::npos) {
Json::String::size_type hasSign =
(s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
JSONCPP_STRING::size_type exponentStartIndex = index + 1 + hasSign;
JSONCPP_STRING normalized = s.substr(0, exponentStartIndex);
JSONCPP_STRING::size_type indexDigit =
s.find_first_not_of('0', exponentStartIndex);
JSONCPP_STRING exponent = "0";
if (indexDigit != JSONCPP_STRING::npos) // There is an exponent different
// from 0
Json::String::size_type exponentStartIndex = index + 1 + hasSign;
Json::String normalized = s.substr(0, exponentStartIndex);
Json::String::size_type indexDigit = s.find_first_not_of('0', exponentStartIndex);
Json::String exponent = "0";
if (indexDigit != Json::String::npos) // There is an exponent different
// from 0
{
exponent = s.substr(indexDigit);
}
@@ -1601,7 +1600,7 @@ JSONTEST_FIXTURE(ValueTest, offsetAccessors) {
JSONTEST_FIXTURE(ValueTest, StaticString) {
char mutant[] = "hello";
Json::StaticString ss(mutant);
JSONCPP_STRING regular(mutant);
Json::String regular(mutant);
mutant[1] = 'a';
JSONTEST_ASSERT_STRING_EQUAL("hallo", ss.c_str());
JSONTEST_ASSERT_STRING_EQUAL("hello", regular.c_str());
@@ -1623,16 +1622,16 @@ JSONTEST_FIXTURE(ValueTest, StaticString) {
JSONTEST_FIXTURE(ValueTest, CommentBefore) {
Json::Value val; // fill val
val.setComment(JSONCPP_STRING("// this comment should appear before"),
val.setComment(Json::String("// this comment should appear before"),
Json::commentBefore);
Json::StreamWriterBuilder wbuilder;
wbuilder.settings_["commentStyle"] = "All";
{
char const expected[] = "// this comment should appear before\nnull";
JSONCPP_STRING result = Json::writeString(wbuilder, val);
Json::String result = Json::writeString(wbuilder, val);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
JSONCPP_STRING res2 = val.toStyledString();
JSONCPP_STRING exp2 = "\n";
Json::String res2 = val.toStyledString();
Json::String exp2 = "\n";
exp2 += expected;
exp2 += "\n";
JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
@@ -1641,10 +1640,10 @@ JSONTEST_FIXTURE(ValueTest, CommentBefore) {
val.swapPayload(other);
{
char const expected[] = "// this comment should appear before\n\"hello\"";
JSONCPP_STRING result = Json::writeString(wbuilder, val);
Json::String result = Json::writeString(wbuilder, val);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
JSONCPP_STRING res2 = val.toStyledString();
JSONCPP_STRING exp2 = "\n";
Json::String res2 = val.toStyledString();
Json::String exp2 = "\n";
exp2 += expected;
exp2 += "\n";
JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
@@ -1655,10 +1654,10 @@ JSONTEST_FIXTURE(ValueTest, CommentBefore) {
// Json::CommentPlacement::commentBefore); Assignment over-writes comments.
{
char const expected[] = "\"hello\"";
JSONCPP_STRING result = Json::writeString(wbuilder, val);
Json::String result = Json::writeString(wbuilder, val);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
JSONCPP_STRING res2 = val.toStyledString();
JSONCPP_STRING exp2 = "";
Json::String res2 = val.toStyledString();
Json::String exp2 = "";
exp2 += expected;
exp2 += "\n";
JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
@@ -1667,7 +1666,7 @@ JSONTEST_FIXTURE(ValueTest, CommentBefore) {
JSONTEST_FIXTURE(ValueTest, zeroes) {
char const cstr[] = "h\0i";
JSONCPP_STRING binary(cstr, sizeof(cstr)); // include trailing 0
Json::String binary(cstr, sizeof(cstr)); // include trailing 0
JSONTEST_ASSERT_EQUAL(4U, binary.length());
Json::StreamWriterBuilder b;
{
@@ -1693,7 +1692,7 @@ JSONTEST_FIXTURE(ValueTest, zeroes) {
JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
char const cstr[] = "h\0i";
JSONCPP_STRING binary(cstr, sizeof(cstr)); // include trailing 0
Json::String binary(cstr, sizeof(cstr)); // include trailing 0
JSONTEST_ASSERT_EQUAL(4U, binary.length());
{
Json::Value root;
@@ -1724,8 +1723,8 @@ JSONTEST_FIXTURE(ValueTest, specialFloats) {
b.settings_["useSpecialFloats"] = true;
Json::Value v = std::numeric_limits<double>::quiet_NaN();
JSONCPP_STRING expected = "NaN";
JSONCPP_STRING result = Json::writeString(b, v);
Json::String expected = "NaN";
Json::String result = Json::writeString(b, v);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
v = std::numeric_limits<double>::infinity();
@@ -1744,8 +1743,8 @@ JSONTEST_FIXTURE(ValueTest, precision) {
b.settings_["precision"] = 5;
Json::Value v = 100.0 / 3;
JSONCPP_STRING expected = "33.333";
JSONCPP_STRING result = Json::writeString(b, v);
Json::String expected = "33.333";
Json::String result = Json::writeString(b, v);
JSONTEST_ASSERT_STRING_EQUAL(expected, result);
v = 0.25000000;
@@ -1820,15 +1819,15 @@ JSONTEST_FIXTURE(StreamWriterTest, dropNullPlaceholders) {
}
JSONTEST_FIXTURE(StreamWriterTest, writeZeroes) {
JSONCPP_STRING binary("hi", 3); // include trailing 0
Json::String binary("hi", 3); // include trailing 0
JSONTEST_ASSERT_EQUAL(3, binary.length());
JSONCPP_STRING expected("\"hi\\u0000\""); // unicoded zero
Json::String expected("\"hi\\u0000\""); // unicoded zero
Json::StreamWriterBuilder b;
{
Json::Value root;
root = binary;
JSONTEST_ASSERT_STRING_EQUAL(binary, root.asString());
JSONCPP_STRING out = Json::writeString(b, root);
Json::String out = Json::writeString(b, root);
JSONTEST_ASSERT_EQUAL(expected.size(), out.size());
JSONTEST_ASSERT_STRING_EQUAL(expected, out);
}
@@ -1836,7 +1835,7 @@ JSONTEST_FIXTURE(StreamWriterTest, writeZeroes) {
Json::Value root;
root["top"] = binary;
JSONTEST_ASSERT_STRING_EQUAL(binary, root["top"].asString());
JSONCPP_STRING out = Json::writeString(b, root["top"]);
Json::String out = Json::writeString(b, root["top"]);
JSONTEST_ASSERT_STRING_EQUAL(expected, out);
}
}
@@ -1937,7 +1936,7 @@ struct CharReaderTest : JsonTest::TestCase {};
JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrors) {
Json::CharReaderBuilder b;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
Json::Value root;
char const doc[] = "{ \"property\" : \"value\" }";
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
@@ -1949,7 +1948,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrors) {
JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrorsTestingOffsets) {
Json::CharReaderBuilder b;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
Json::Value root;
char const doc[] = "{ \"property\" : [\"value\", \"value2\"], \"obj\" : "
"{ \"nested\" : 123, \"bool\" : true}, \"null\" : "
@@ -1963,7 +1962,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrorsTestingOffsets) {
JSONTEST_FIXTURE(CharReaderTest, parseWithOneError) {
Json::CharReaderBuilder b;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
Json::Value root;
char const doc[] = "{ \"property\" :: \"value\" }";
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
@@ -1977,7 +1976,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseWithOneError) {
JSONTEST_FIXTURE(CharReaderTest, parseChineseWithOneError) {
Json::CharReaderBuilder b;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
Json::Value root;
char const doc[] = "{ \"pr佐藤erty\" :: \"value\" }";
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
@@ -1991,7 +1990,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseChineseWithOneError) {
JSONTEST_FIXTURE(CharReaderTest, parseWithDetailError) {
Json::CharReaderBuilder b;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
Json::Value root;
char const doc[] = "{ \"property\" : \"v\\alue\" }";
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
@@ -2009,7 +2008,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseWithStackLimit) {
{
b.settings_["stackLimit"] = 2;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT(errs.empty());
@@ -2019,7 +2018,7 @@ JSONTEST_FIXTURE(CharReaderTest, parseWithStackLimit) {
{
b.settings_["stackLimit"] = 1;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
JSONTEST_ASSERT_THROWS(
reader->parse(doc, doc + std::strlen(doc), &root, &errs));
delete reader;
@@ -2036,7 +2035,7 @@ JSONTEST_FIXTURE(CharReaderStrictModeTest, dupKeys) {
{
b.strictMode(&b.settings_);
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(!ok);
JSONTEST_ASSERT_STRING_EQUAL("* Line 1, Column 41\n"
@@ -2056,7 +2055,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
{
b.settings_["failIfExtra"] = false;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT(errs.empty());
@@ -2066,7 +2065,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
{
b.settings_["failIfExtra"] = true;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(!ok);
JSONTEST_ASSERT_STRING_EQUAL(errs,
@@ -2079,7 +2078,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
b.settings_["failIfExtra"] = false;
b.strictMode(&b.settings_);
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(!ok);
JSONTEST_ASSERT_STRING_EQUAL(errs,
@@ -2096,7 +2095,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue107) {
char const doc[] = "1:2:3";
b.settings_["failIfExtra"] = true;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(!ok);
JSONTEST_ASSERT_STRING_EQUAL("* Line 1, Column 2\n"
@@ -2112,7 +2111,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterObject) {
char const doc[] = "{ \"property\" : \"value\" } //trailing\n//comment\n";
b.settings_["failIfExtra"] = true;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT_STRING_EQUAL("", errs);
@@ -2126,7 +2125,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterArray) {
char const doc[] = "[ \"property\" , \"value\" ] //trailing\n//comment\n";
b.settings_["failIfExtra"] = true;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT_STRING_EQUAL("", errs);
@@ -2139,7 +2138,7 @@ JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterBool) {
char const doc[] = " true /*trailing\ncomment*/";
b.settings_["failIfExtra"] = true;
Json::CharReader* reader(b.newCharReader());
JSONCPP_STRING errs;
Json::String errs;
bool ok = reader->parse(doc, doc + std::strlen(doc), &root, &errs);
JSONTEST_ASSERT(ok);
JSONTEST_ASSERT_STRING_EQUAL("", errs);
@@ -2152,7 +2151,7 @@ JSONTEST_FIXTURE(CharReaderAllowDropNullTest, issue178) {
Json::CharReaderBuilder b;
b.settings_["allowDroppedNullPlaceholders"] = true;
Json::Value root;
JSONCPP_STRING errs;
Json::String errs;
Json::CharReader* reader(b.newCharReader());
{
char const doc[] = "{\"a\":,\"b\":true}";
@@ -2274,7 +2273,7 @@ JSONTEST_FIXTURE(CharReaderAllowSingleQuotesTest, issue182) {
Json::CharReaderBuilder b;
b.settings_["allowSingleQuotes"] = true;
Json::Value root;
JSONCPP_STRING errs;
Json::String errs;
Json::CharReader* reader(b.newCharReader());
{
char const doc[] = "{'a':true,\"b\":true}";
@@ -2303,7 +2302,7 @@ JSONTEST_FIXTURE(CharReaderAllowZeroesTest, issue176) {
Json::CharReaderBuilder b;
b.settings_["allowSingleQuotes"] = true;
Json::Value root;
JSONCPP_STRING errs;
Json::String errs;
Json::CharReader* reader(b.newCharReader());
{
char const doc[] = "{'a':true,\"b\":true}";
@@ -2332,7 +2331,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
Json::CharReaderBuilder b;
b.settings_["allowSpecialFloats"] = true;
Json::Value root;
JSONCPP_STRING errs;
Json::String errs;
Json::CharReader* reader(b.newCharReader());
{
char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity}";
@@ -2351,7 +2350,7 @@ JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
struct TestData {
int line;
bool ok;
JSONCPP_STRING in;
Json::String in;
};
const TestData test_data[] = {
{ __LINE__, true, "{\"a\":9}" }, //
@@ -2426,7 +2425,7 @@ JSONTEST_FIXTURE(IteratorTest, distance) {
json["k1"] = "a";
json["k2"] = "b";
int dist = 0;
JSONCPP_STRING str;
Json::String str;
for (Json::ValueIterator it = json.begin(); it != json.end(); ++it) {
dist = it - json.begin();
str = it->asString().c_str();
@@ -2480,19 +2479,19 @@ JSONTEST_FIXTURE(IteratorTest, const) {
Json::Value value;
for (int i = 9; i < 12; ++i) {
JSONCPP_OSTRINGSTREAM out;
Json::OStringStream out;
out << std::setw(2) << i;
JSONCPP_STRING str = out.str();
Json::String str = out.str();
value[str] = str;
}
JSONCPP_OSTRINGSTREAM out;
Json::OStringStream out;
// in old code, this will get a compile error
Json::Value::const_iterator iter = value.begin();
for (; iter != value.end(); ++iter) {
out << *iter << ',';
}
JSONCPP_STRING expected = "\" 9\",\"10\",\"11\",";
Json::String expected = "\" 9\",\"10\",\"11\",";
JSONTEST_ASSERT_STRING_EQUAL(expected, out.str());
}