forked from bblanchon/ArduinoJson
Added newline at ed of file
This commit is contained in:
@ -27,4 +27,4 @@ class CompactJsonWriter : public JsonWriter {
|
|||||||
virtual void endObject() { _length += _sink->write('}'); }
|
virtual void endObject() { _length += _sink->write('}'); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,4 +161,4 @@ class JsonNode {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,4 @@ class JsonParser {
|
|||||||
inline JsonNode *parseString();
|
inline JsonNode *parseString();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,4 +57,4 @@ class PrettyJsonWriter : public JsonWriter {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ class QuotedString {
|
|||||||
static char *extractFrom(char *input, char **end);
|
static char *extractFrom(char *input, char **end);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,4 @@ class StringBuilder : public Print {
|
|||||||
int length;
|
int length;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,4 +32,4 @@ class JsonArrayIterator {
|
|||||||
private:
|
private:
|
||||||
Internals::JsonNode *_node;
|
Internals::JsonNode *_node;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,4 @@ class JsonBuffer {
|
|||||||
Internals::JsonNode *value);
|
Internals::JsonNode *value);
|
||||||
Internals::JsonNode *createStringNode(const char *value);
|
Internals::JsonNode *createStringNode(const char *value);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -49,4 +49,4 @@ class JsonContainer : public Printable, public Internals::JsonNodeWrapper {
|
|||||||
void removeChild(Internals::JsonNode *);
|
void removeChild(Internals::JsonNode *);
|
||||||
Internals::JsonNode *createNode();
|
Internals::JsonNode *createNode();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -31,4 +31,4 @@ class JsonObject : public JsonContainer {
|
|||||||
private:
|
private:
|
||||||
Internals::JsonNode *getOrCreateNodeAt(const char *key);
|
Internals::JsonNode *getOrCreateNodeAt(const char *key);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -38,4 +38,4 @@ class JsonObjectIterator {
|
|||||||
private:
|
private:
|
||||||
JsonObjectKeyValue _objectKeyValue;
|
JsonObjectKeyValue _objectKeyValue;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,4 @@ class JsonObjectKeyValue {
|
|||||||
private:
|
private:
|
||||||
Internals::JsonNode *_node;
|
Internals::JsonNode *_node;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -43,4 +43,4 @@ class JsonValue : public Internals::JsonNodeWrapper {
|
|||||||
return static_cast<T>(*this);
|
return static_cast<T>(*this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
cd ..
|
cd ..
|
||||||
find include src test -regex ".*\.[ch]pp$" -exec clang-format -style=Google -i {} \;
|
FILES=$(find include src test -regex ".*\.[ch]pp$")
|
||||||
|
|
||||||
|
clang-format -style=Google -i $FILES
|
||||||
|
|
||||||
|
# insert newline at end of file
|
||||||
|
sed -i -e '$a\' $FILES
|
||||||
|
@ -31,4 +31,4 @@ size_t Print::print(long value) {
|
|||||||
|
|
||||||
size_t Print::println() { return write('\r') + write('\n'); }
|
size_t Print::println() { return write('\r') + write('\n'); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,4 +38,4 @@ inline size_t IndentedPrint::writeTabs() {
|
|||||||
for (int i = 0; i < level * tabSize; i++) n += sink->write(' ');
|
for (int i = 0; i < level * tabSize; i++) n += sink->write(' ');
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,4 @@ void JsonWriter::writeBoolean(bool value) {
|
|||||||
|
|
||||||
void JsonWriter::writeDouble(double value, int decimals) {
|
void JsonWriter::writeDouble(double value, int decimals) {
|
||||||
_length += _sink->print(value, decimals);
|
_length += _sink->print(value, decimals);
|
||||||
}
|
}
|
||||||
|
@ -96,4 +96,4 @@ char *QuotedString::extractFrom(char *input, char **endPtr) {
|
|||||||
*endPtr = readPtr;
|
*endPtr = readPtr;
|
||||||
|
|
||||||
return startPtr;
|
return startPtr;
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,4 @@ size_t StringBuilder::write(uint8_t c) {
|
|||||||
buffer[length++] = c;
|
buffer[length++] = c;
|
||||||
buffer[length] = 0;
|
buffer[length] = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -87,4 +87,4 @@ JsonArrayIterator JsonArray::begin() {
|
|||||||
if (!_node) return end();
|
if (!_node) return end();
|
||||||
|
|
||||||
return JsonArrayIterator(_node->getContainerChild());
|
return JsonArrayIterator(_node->getContainerChild());
|
||||||
}
|
}
|
||||||
|
@ -94,4 +94,4 @@ JsonNode *JsonBuffer::createStringNode(const char *value) {
|
|||||||
if (node) node->setAsString(value);
|
if (node) node->setAsString(value);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -69,4 +69,4 @@ JsonNode *JsonObject::getOrCreateNodeAt(const char *key) {
|
|||||||
|
|
||||||
JsonObjectIterator JsonObject::begin() {
|
JsonObjectIterator JsonObject::begin() {
|
||||||
return JsonObjectIterator(_node->getContainerChild());
|
return JsonObjectIterator(_node->getContainerChild());
|
||||||
}
|
}
|
||||||
|
@ -42,4 +42,4 @@ JsonValue::operator long() const { return _node ? _node->getAsInteger() : 0; }
|
|||||||
|
|
||||||
JsonValue::operator JsonArray() const { return JsonArray(_node); }
|
JsonValue::operator JsonArray() const { return JsonArray(_node); }
|
||||||
|
|
||||||
JsonValue::operator JsonObject() const { return JsonObject(_node); }
|
JsonValue::operator JsonObject() const { return JsonObject(_node); }
|
||||||
|
@ -132,4 +132,4 @@ TEST_F(JsonArray_Container_Tests, CanCreateNestedObjects) {
|
|||||||
firstElementMustBe(innerObject1);
|
firstElementMustBe(innerObject1);
|
||||||
secondElementMustBe(innerObject2);
|
secondElementMustBe(innerObject2);
|
||||||
nodeCountMustBe(3);
|
nodeCountMustBe(3);
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,4 @@ TEST(JsonArray_Iterator_Test, SimpleTest) {
|
|||||||
EXPECT_EQ(34, (*it).as<int>()); // TODO: use ->
|
EXPECT_EQ(34, (*it).as<int>()); // TODO: use ->
|
||||||
++it;
|
++it;
|
||||||
EXPECT_EQ(array.end(), it);
|
EXPECT_EQ(array.end(), it);
|
||||||
}
|
}
|
||||||
|
@ -80,4 +80,4 @@ TEST_F(JsonArray_PrettyPrintTo_Tests, NestedArrays) {
|
|||||||
" \"key\": 3\r\n"
|
" \"key\": 3\r\n"
|
||||||
" }\r\n"
|
" }\r\n"
|
||||||
"]");
|
"]");
|
||||||
}
|
}
|
||||||
|
@ -125,4 +125,4 @@ TEST_F(JsonArray_PrintTo_Tests, OneEmptyNestedHash) {
|
|||||||
array.createNestedObject();
|
array.createNestedObject();
|
||||||
|
|
||||||
outputMustBe("[{}]");
|
outputMustBe("[{}]");
|
||||||
}
|
}
|
||||||
|
@ -111,4 +111,4 @@ TEST_F(JsonObject_Container_Tests, CanStoreInnerObjects) {
|
|||||||
|
|
||||||
EXPECT_EQ(innerObject1, (JsonObject)object["hello"]);
|
EXPECT_EQ(innerObject1, (JsonObject)object["hello"]);
|
||||||
EXPECT_EQ(innerObject2, (JsonObject)object["world"]);
|
EXPECT_EQ(innerObject2, (JsonObject)object["world"]);
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,4 @@ TEST(JsonObject_Iterator_Test, SimpleTest) {
|
|||||||
EXPECT_EQ(34, it->value().as<int>());
|
EXPECT_EQ(34, it->value().as<int>());
|
||||||
++it;
|
++it;
|
||||||
EXPECT_EQ(object.end(), it);
|
EXPECT_EQ(object.end(), it);
|
||||||
}
|
}
|
||||||
|
@ -77,4 +77,4 @@ TEST_F(JsonObject_PrettyPrintTo_Tests, NestedContainers) {
|
|||||||
" 2\r\n"
|
" 2\r\n"
|
||||||
" ]\r\n"
|
" ]\r\n"
|
||||||
"}");
|
"}");
|
||||||
}
|
}
|
||||||
|
@ -138,4 +138,4 @@ TEST_F(JsonObject_Serialization_Tests, OneEmptyNestedArray) {
|
|||||||
object.createNestedArray("key");
|
object.createNestedArray("key");
|
||||||
|
|
||||||
outputMustBe("{\"key\":[]}");
|
outputMustBe("{\"key\":[]}");
|
||||||
}
|
}
|
||||||
|
@ -145,4 +145,4 @@ TEST_F(JsonParser_Array_Tests, TwoStrings) {
|
|||||||
sizeMustBe(2);
|
sizeMustBe(2);
|
||||||
firstElementMustBe("hello");
|
firstElementMustBe("hello");
|
||||||
secondElementMustBe("world");
|
secondElementMustBe("world");
|
||||||
}
|
}
|
||||||
|
@ -53,4 +53,4 @@ TEST(JsonParser_Nested_Tests, ObjectNestedInArray) {
|
|||||||
EXPECT_EQ(2, object1["b"].as<int>());
|
EXPECT_EQ(2, object1["b"].as<int>());
|
||||||
EXPECT_EQ(3, object2["c"].as<int>());
|
EXPECT_EQ(3, object2["c"].as<int>());
|
||||||
EXPECT_EQ(4, object2["d"].as<int>());
|
EXPECT_EQ(4, object2["d"].as<int>());
|
||||||
}
|
}
|
||||||
|
@ -171,4 +171,4 @@ TEST_F(JsonParser_Object_Test, TwoNulls) {
|
|||||||
TEST_F(JsonParser_Object_Test, NullForKey) {
|
TEST_F(JsonParser_Object_Test, NullForKey) {
|
||||||
whenInputIs("null:\"value\"}");
|
whenInputIs("null:\"value\"}");
|
||||||
parseMustFail();
|
parseMustFail();
|
||||||
}
|
}
|
||||||
|
@ -108,4 +108,4 @@ TEST_F(JsonValueTests, ArraysAreCopiedByReference) {
|
|||||||
array.add("world");
|
array.add("world");
|
||||||
|
|
||||||
EXPECT_EQ(1, ((JsonObject)jsonValue1).size());
|
EXPECT_EQ(1, ((JsonObject)jsonValue1).size());
|
||||||
}
|
}
|
||||||
|
@ -127,4 +127,4 @@ TEST_F(QuotedString_ExtractFrom_Tests, EscapedTab) {
|
|||||||
TEST_F(QuotedString_ExtractFrom_Tests, AllEscapedCharsTogether) {
|
TEST_F(QuotedString_ExtractFrom_Tests, AllEscapedCharsTogether) {
|
||||||
whenInputIs("\"1\\\"2\\\\3\\/4\\b5\\f6\\n7\\r8\\t9\"");
|
whenInputIs("\"1\\\"2\\\\3\\/4\\b5\\f6\\n7\\r8\\t9\"");
|
||||||
resultMustBe("1\"2\\3/4\b5\f6\n7\r8\t9");
|
resultMustBe("1\"2\\3/4\b5\f6\n7\r8\t9");
|
||||||
}
|
}
|
||||||
|
@ -76,4 +76,4 @@ TEST_F(QuotedString_PrintTo_Tests, CarriageReturn) {
|
|||||||
TEST_F(QuotedString_PrintTo_Tests, HorizontalTab) {
|
TEST_F(QuotedString_PrintTo_Tests, HorizontalTab) {
|
||||||
whenInputIs("\t");
|
whenInputIs("\t");
|
||||||
outputMustBe("\"\\t\"");
|
outputMustBe("\"\\t\"");
|
||||||
}
|
}
|
||||||
|
@ -72,4 +72,4 @@ TEST(
|
|||||||
|
|
||||||
obj["hello"];
|
obj["hello"];
|
||||||
EXPECT_EQ(3, json.size());
|
EXPECT_EQ(3, json.size());
|
||||||
}
|
}
|
||||||
|
@ -57,4 +57,4 @@ TEST_F(StringBuilderTests, TwoStrings) {
|
|||||||
resultMustBe(4);
|
resultMustBe(4);
|
||||||
|
|
||||||
outputMustBe("ABCDEFGH");
|
outputMustBe("ABCDEFGH");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user