diff --git a/extras/tests/JsonObject/iterator.cpp b/extras/tests/JsonObject/iterator.cpp index f730da91..49741e5d 100644 --- a/extras/tests/JsonObject/iterator.cpp +++ b/extras/tests/JsonObject/iterator.cpp @@ -40,15 +40,18 @@ TEST_CASE("JsonObjectConst::begin()/end()") { JsonObjectConst cobj = obj; - SECTION("NonConstIterator") { + SECTION("Iteration") { JsonObjectConst::iterator it = cobj.begin(); REQUIRE(cobj.end() != it); REQUIRE(it->key() == "ab"); REQUIRE(12 == it->value()); + ++it; REQUIRE(cobj.end() != it); - REQUIRE(it->key() == "cd"); - REQUIRE(34 == it->value()); + JsonPairConst pair = *it; + REQUIRE(pair.key() == "cd"); + REQUIRE(34 == pair.value()); + ++it; REQUIRE(cobj.end() == it); } diff --git a/src/ArduinoJson.hpp b/src/ArduinoJson.hpp index 987ab654..d142bb91 100644 --- a/src/ArduinoJson.hpp +++ b/src/ArduinoJson.hpp @@ -46,6 +46,7 @@ typedef ARDUINOJSON_NAMESPACE::Integer JsonInteger; typedef ARDUINOJSON_NAMESPACE::ObjectConstRef JsonObjectConst; typedef ARDUINOJSON_NAMESPACE::ObjectRef JsonObject; typedef ARDUINOJSON_NAMESPACE::Pair JsonPair; +typedef ARDUINOJSON_NAMESPACE::PairConst JsonPairConst; typedef ARDUINOJSON_NAMESPACE::String JsonString; typedef ARDUINOJSON_NAMESPACE::UInt JsonUInt; typedef ARDUINOJSON_NAMESPACE::VariantConstRef JsonVariantConst;