Skip to content

Commit 18dc444

Browse files
author
Tim Aitken
committed
get basic tests running
1 parent b69334b commit 18dc444

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/lib_json/json_reader.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,9 @@ bool OurReader::readValue() {
10831083
case tokenNumber:
10841084
successful = decodeNumber(token);
10851085
break;
1086+
case tokenHexadecimal:
1087+
successful = decodeHexadecimal(token);
1088+
break;
10861089
case tokenString:
10871090
successful = decodeString(token);
10881091
break;
@@ -1969,7 +1972,7 @@ CharReader* CharReaderBuilder::newCharReader() const {
19691972
features.failIfExtra_ = settings_["failIfExtra"].asBool();
19701973
features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
19711974
features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
1972-
features.allowHexadecimal_ = settings_["allowHexacecimal"].asBool();
1975+
features.allowHexadecimal_ = settings_["allowHexadecimal"].asBool();
19731976
features.skipBom_ = settings_["skipBom"].asBool();
19741977
return new OurCharReader(collectComments, features);
19751978
}
@@ -1987,7 +1990,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const {
19871990
"failIfExtra",
19881991
"rejectDupKeys",
19891992
"allowSpecialFloats",
1990-
"allowHexacecimal",
1993+
"allowHexadecimal",
19911994
"skipBom",
19921995
};
19931996
for (auto si = settings_.begin(); si != settings_.end(); ++si) {

src/test_lib_json/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3577,6 +3577,8 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, disallowHex) {
35773577
JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, hexObject) {
35783578
Json::CharReaderBuilder b;
35793579
b.settings_["allowHexadecimal"] = true;
3580+
Json::Value invalid;
3581+
JSONTEST_ASSERT(b.validate(&invalid)) << invalid;
35803582
CharReaderPtr reader(b.newCharReader());
35813583
{
35823584
Json::Value root;
@@ -3622,7 +3624,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, hexNumbers) {
36223624
const char* c0 = td.in.c_str();
36233625
const char* c1 = c0 + td.in.size();
36243626
bool ok = reader->parse(c0, c1, &root, &errs);
3625-
JSONTEST_ASSERT_EQUAL(td.ok, ok);
3627+
JSONTEST_ASSERT(td.ok == ok) << "in: " << td.in;
36263628
if (td.ok)
36273629
{
36283630
JSONTEST_ASSERT_EQUAL(0u, errs.size());

0 commit comments

Comments
 (0)