8000 The test passes! · sarfata/ArduinoJson@5fbe0cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 5fbe0cf

Browse files
committed
The test passes!
1 parent af42239 commit 5fbe0cf

File tree

6 files changed

+17
-23
lines changed

6 files changed

+17
-23
lines changed

src/ArduinoJson/Data/List.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class List {
3030
// When buffer is NULL, the List is not able to grow and success() returns
3131
// false. This is used to identify bad memory allocations and parsing
3232
// failures.
33-
explicit List(JsonBuffer *buf) : _buffer(buf), _firstNode(NULL) {}
33+
explicit List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {}
3434

3535
// Returns true if the object is valid
3636
// Would return false in the following situation:
@@ -87,10 +87,6 @@ class List {
8787
}
8888
}
8989

90-
JsonBuffer *buffer() const {
91-
return _buffer;
92-
}
93-
9490
protected:
9591
JsonBuffer *_buffer;
9692

src/ArduinoJson/JsonArray.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class JsonArray : public Internals::JsonPrintable<JsonArray>,
4646
// Create an empty JsonArray attached to the specified JsonBuffer.
4747
// You should not call this constructor directly.
4848
// Instead, use JsonBuffer::createArray() or JsonBuffer::parseArray().
49-
explicit JsonArray(JsonBuffer *buf) throw()
50-
: Internals::List<JsonVariant>(buf) {}
49+
explicit JsonArray(JsonBuffer *buffer) throw()
50+
: Internals::List<JsonVariant>(buffer) {}
5151

5252
// Gets the value at the specified index
5353
const JsonArraySubscript operator[](size_t index) const;

src/ArduinoJson/JsonObject.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class JsonObject : public Internals::JsonPrintable<JsonObject>,
4545
// Create an empty JsonArray attached to the specified JsonBuffer.
4646
// You should not use this constructor directly.
4747
// Instead, use JsonBuffer::createObject() or JsonBuffer.parseObject().
48-
explicit JsonObject(JsonBuffer* buf) throw()
49-
: Internals::List<JsonPair>(buf) {}
48+
explicit JsonObject(JsonBuffer* buffer) throw()
49+
: Internals::List<JsonPair>(buffer) {}
5050

5151
// Gets or sets the value associated with the specified key.
5252
//

src/ArduinoJson/StaticJsonArray.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class StaticJsonArray : public JsonArray {
2222
_buffer.alloc(sizeof(JsonArray));
2323
}
2424

25-
StaticJsonBufferBase& buffer() {
26-
return _buffer;
25+
StaticJsonBufferBase* buffer() {
26+
return &_buffer;
2727
}
2828
};
2929
}

src/ArduinoJson/parseJson.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@
1010
namespace ArduinoJson {
1111
// bool parseJson(JsonArray& destination, TString json);
1212
// TString = const std::string&, const String&
13-
template <typename TString>
13+
template <typename TDestination, typename TString>
1414
typename TypeTraits::EnableIf<!TypeTraits::IsArray<TString>::value, bool>::type
15-
parseJson(JsonArray &destination, const TString &json,
15+
parseJson(TDestination &destination, const TString &json,
1616
uint8_t nestingLimit = ARDUINOJSON_DEFAULT_NESTING_LIMIT) {
1717
return Internals::makeParser(destination.buffer(), json, nestingLimit)
1818
.parseArray(destination);
1919
}
2020
//
2121
// bool parseJson(JsonArray& destination, TString json);
2222
// TString = const char*, const char[N], const FlashStringHelper*
23-
template <typename TString>
24-
bool parseJson(JsonArray &destination, TString *json,
23+
template <typename TDestination, typename TString>
24+
bool parseJson(TDestination &destination, TString *json,
2525
uint8_t nestingLimit = ARDUINOJSON_DEFAULT_NESTING_LIMIT) {
2626
return Internals::makeParser(destination.buffer(), json, nestingLimit)
2727
.parseArray(destination);
2828
}
2929
//
3030
// bool parseJson(JsonArray& destination, TString json);
3131
// TString = std::istream&, Stream&
32-
template <typename TString>
33-
bool parseJson(JsonArray &destination, TString &json,
32+
template <typename TDestination, typename TString>
33+
bool parseJson(TDestination &destination, TString &json,
3434
uint8_t nestingLimit = ARDUINOJSON_DEFAULT_NESTING_LIMIT) {
3535
return Internals::makeParser(destination.buffer(), json, nestingLimit)
3636
.parseArray(destination);

test/StaticJsonBuffer/parseArray.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44, 6D47 10 @@ TEST_CASE("StaticJsonBuffer::parseArray()") {
4444
REQUIRE(false == parseJson(arr, static_cast<char*>(0)));
4545
}
4646

47-
// TODO
48-
/* SECTION("Input is const char* NULL") {
49-
StaticJsonBuffer<100> jb;
50-
JsonArray& arr = jb.createArray();
51-
REQUIRE(false == parseJson(arr, static_cast<const char*>(0)));
52-
}*/
47+
SECTION("Input is const char* NULL") {
48+
StaticJsonArray<100> arr;
49+
REQUIRE(false == parseJson(arr, static_cast<const char*>(0)));
50+
}
5351

5452
SECTION("CopyStringNotSpaces") {
5553
StaticJsonBuffer<100> jsonBuffer;

0 commit comments

Comments
 (0)
0